all groups > dotnet sdk > january 2006 >
You're in the

dotnet sdk

group:

app use newer versions of a DLL


app use newer versions of a DLL David Thielen
1/16/2006 6:32:02 AM
dotnet sdk:
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?

--
RE: app use newer versions of a DLL David Thielen
1/17/2006 6:27:03 AM
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.

--
thanks - dave


[quoted text, click to view]
RE: app use newer versions of a DLL v-phuang NO[at]SPAM online.microsoft.com (
1/17/2006 8:02:43 AM
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

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
RE: app use newer versions of a DLL David Thielen
1/17/2006 7:39:03 PM
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?

--
thanks - dave


[quoted text, click to view]
RE: app use newer versions of a DLL v-phuang NO[at]SPAM online.microsoft.com (
1/18/2006 3:08:18 AM
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

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Re: app use newer versions of a DLL NuTcAsE
1/18/2006 8:50:40 AM
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/cpconcreatingpublisherpolicyfile.asp

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

Hope this helps...

- NuTcAsE
Re: app use newer versions of a DLL David Thielen
1/18/2006 9:31:05 AM
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?

--
thanks - dave


[quoted text, click to view]
RE: app use newer versions of a DLL v-phuang NO[at]SPAM online.microsoft.com (
1/19/2006 6:02:41 AM
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

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