Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / January 2006

Tip: Looking for answers? Try searching our database.

app use newer versions of a DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Thielen - 16 Jan 2006 14:32 GMT
Hi;

I have an application that is built to use version 4.1.2.0 of my DLL (app
and DLL are mine). I want to set the app so it will use any version of the
DLL 4.1.*.* - without adding a config file. How can I do this?

Signature

thanks - dave

"Peter Huang" [MSFT] - 17 Jan 2006 08:02 GMT
Hi Dave,

I did not understanding the problem very much.
Do you mean you have application and a DLL?
The Application will load the DLL in the same directory.
e.g.
bin\app.exe
bin\test.dll

The test.dll's version may be changed. e.g. from 4.1.2.0 to 4.1.3.0. But
you did not want to recompile the app.exe.
So you want to know how to set the app.exe to load the 4.1.3.0 without
using app.config and recompiling the app.exe.

Based on my test, if we recompile the test.dll can copy it into the same
dir of app.exe, the app.exe which loaded the dll will work.

If I have misunderstood, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

David Thielen - 17 Jan 2006 14:27 GMT
Hi;

Yes, exactly as you said. But when I run, I am getting "Could not load file
or assembly 'WindwardReportsAPI, Version=4.1.2.0, Culture=neutral, PublicKey
Token=9159ad800b91f253' or one of its dependencies. The located assembly's
manifest does not match the assembly reference. (Exception from
HRESULT:0x80131040)"

One other thing - this is actually a case where my "app" is a Word Add-In so
it is a DLL that is trying to call this other DLL. All of the DLLs involved
are strongly named and authenticode signed.

Signature

thanks - dave

> Hi Dave,
>
[quoted text clipped - 22 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 18 Jan 2006 03:08 GMT
Hi Dave,

If you are using a strongnamed dll, then the CLR will try to locate the DLL
with full qualified name including the exactly DLL name, version, culture,
public key and so on.
This is by design. Because when we strongnamed a DLL, we expected to load
the DLL exactly when we complied.

In this scenario, we have to use <bindingRedirect> Element in the
app.config file.
http://msdn2.microsoft.com/en-us/library/eftw1fys.aspx

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

David Thielen - 18 Jan 2006 03:39 GMT
Hello;

Ok, if I don't want to use the config file because that requires the user to
edit it which is a pain for them and they can screw it up - how do I do this?
Word wants strongly named dlls for it's Add-Ins, security requires strong
naming. But I want to allow minor version changes to work together.

It seems to me this would be a common request - to match the strong name
hash and that the major.minor version number matches, but the revision.build
does not need to match. Is there some way to pre-load the DLL, check the
match myself, and then if it's loaded, .NET just uses it?

Signature

thanks - dave

> Hi Dave,
>
[quoted text clipped - 15 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
NuTcAsE - 18 Jan 2006 16:50 GMT
You could do this by creating a publisher policy (since your assemblies
are strongly signed and authenticode singned).

MSDN Link to creating a publisher policy:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
concreatingpublisherpolicyfile.asp


Another article on creating publisher policies:
http://www.informit.com/guides/content.asp?g=dotnet&seqNum=362&rl=1

Hope this helps...

- NuTcAsE
David Thielen - 18 Jan 2006 17:31 GMT
Hello;

That would work for some cases but I think it may be a bad idea in ours. We
have a program that anyone can install - a single msi file and it asks the
standard what directory and that's it. And no admin rights required.

I think this would get tricky as we now need this file to go in the GAC
which could require an administrator. Also, our files are not in the GAC - I
assume that is ok for this as it does not say it's required.

So...

1) Does placing this in the GAC require more permissions than installing DLL
files to a directory under Program Files?
2) Will this work if the DLLs involved are not in the GAC?

Signature

thanks - dave

> You could do this by creating a publisher policy (since your assemblies
> are strongly signed and authenticode singned).
[quoted text clipped - 8 lines]
>
> - NuTcAsE
"Peter Huang" [MSFT] - 19 Jan 2006 06:02 GMT
Hi Dave,

To match the full qualified name of a strongname DLL is the by design
behavior, which is used to protect the identity of a certian dll.
We can not change the default behavior, unless we customized ourself CLR
runtime.
But this did not apply to the Office application, because the CLR is setup
and lauched by Word.

Also it is not trivial to develop an customized CLR.

Here is a book for your reference.

Customizing the Microsoft? .NET Framework Common Language Runtime  
http://www.microsoft.com/MSPress/books/6895.asp

The app.config commonly should be changed by the deployment when we want to
deploy a new version DLL to the end user, we can change the app.config in
the deployment package.

Thanks!

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.