views:

349

answers:

1

Hi All,

I have a ASP.NET web application in which I have references to a couple of Class Libraries I developed. Each of these libraries has a version number set in the AssemblyInfo.cs file.

I would like to force the application to use only libraries with a specific version. i.e.

If I have User.dll of version 2.5.0.0 which is a referenced in the web application, and I try to copy in User.dll of version 3.0.0.0 I want the application to fail... or well just give me an error of some sort.

Also I do not want to store the assemblies in the GAC.

Is there some setting in web.config file I could use?

Thanks

A: 

You need to sign the referenced assemblies with a strong name.

Darin Dimitrov
Ok I understand I have to sign the assembly, but then how will the application know what version it has to use ? Thanks for your help
Pechar
When you reference a signed assembly the application will look for the particular version it is compiled against.
Darin Dimitrov
... and if the versions/culture/public key tokens don't match a `FileLoadException` will be thrown.
Darin Dimitrov
Thanks a lot that worked! When I replaced the dll with an older one I got the FileLoadException. The weird thing is when I replaced the old one with the original dll, it threw the exception again. I had to recompile the application for it to work. Is this normal? Really appreciate your help
Pechar