What happens to original reference if I upgrade .NET assembly?  
Author Message
Lorry Craig





PostPosted: Common Language Runtime, What happens to original reference if I upgrade .NET assembly? Top

Hello,

I have 2 projects (front-end and business code) front-end is referencing business code project. I install business code assembly into GAC.

If I update business code project later on and change version number on it, recompile it and put into GAC which version of assembly my front-end application will be using The one which it was compiled with or latest one in GAC How do I control this



.NET Development19  
 
 
TaylorMichaelL





PostPosted: Common Language Runtime, What happens to original reference if I upgrade .NET assembly? Top

By default it will use the version put into the GAC. Therefore if you were to remove the original version from the GAC then your front-end wouldn't compile or run. However you can change the file properties in your project to say that a specific version is not needed. Also be aware that an option exists to copy the binary local so it is possible that even if you delete it from the GAC it might still be using a local copy.

You can also control the version used outside VS by defining a versioning policy for your assembly. This versioning policy, for example, can tell clients who use v1.0 of an asembly to actually use v1.1 instead. Note however that you should only do this for critical updates to your program rather than just to force people to upgrade to a newer version. One of the big reasons for the GAC is to allow side-by-side versioning. If you don't want this functionality then you probably shouldn't be using the GAC.

Michael Taylor - 10/13/06


 
 
Lorry Craig





PostPosted: Common Language Runtime, What happens to original reference if I upgrade .NET assembly? Top

What propertie is that ("you can change the file properties in your project to say that a specific version is not needed.")
 
 
TaylorMichaelL





PostPosted: Common Language Runtime, What happens to original reference if I upgrade .NET assembly? Top

If you open the properties of a reference (right-click the reference and select Properties) then the option is Specific Version.

Michael Taylor - 10/13/06


 
 
Lorry Craig





PostPosted: Common Language Runtime, What happens to original reference if I upgrade .NET assembly? Top

Can I do the same trick for .NET framework dependency
 
 
Lorry Craig





PostPosted: Common Language Runtime, What happens to original reference if I upgrade .NET assembly? Top

"Specific version" attribute is missing from refefence made to project rather then directly to assembly. This is expected I would guess
 
 
TaylorMichaelL





PostPosted: Common Language Runtime, What happens to original reference if I upgrade .NET assembly? Top

Not really. If you compile using VS2005 then you are targeting v2.0. If you compile against VS2003 you are targeting v1.x. You can use MSBee from MS to build against v1.1 with MSBuild itself but VS won't work quite right. When v3.0 is released there will probably be an option to select v2 or v3 but for now there is nothing inside the IDE.

Michael Taylor - 10/13/06


 
 
TaylorMichaelL





PostPosted: Common Language Runtime, What happens to original reference if I upgrade .NET assembly? Top

Yes when you reference a project it will use the output from the build process rather than a specific file version.

Michael Taylor - 10/13/06