Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MsBuild: Changing References from ProjectReference to Reference

In our environment, we have two in-house frameworks and a separate website. During development, the references to the in-house frameworks tend to be set tp project references. However, once we move to release, the in-house frameworks are installed into the GAC as they are used for multiple instances of the website on each server. All of the ProjectReferences are changed, by hand, to References and the website assemblies and website are re-compiled and deployed.

I am attempting to automate this process. What is the best way to handle these issues? I have started to learn MsBuild in the attempt to accomplish this, but am totally confused. Any pointers and/or suggestions on how to proceed?

like image 663
David Williams Avatar asked Oct 14 '22 01:10

David Williams


1 Answers

As far as I am aware there shouldn't be any need to change from using project references to file references simply because the assembly is registered in the GAC - as long as the referenced project is strongly typed at the point that it is built, the reference should still be valid.

Clarification:

There is no fundamental difference between a GAC reference and a file reference - if you have a reference to a strongly named assembly, and that assembly is placed in the GAC then the end application will load that assembly from the GAC.

See this link for more information on how the runtime locates referenced assemblies:

  • http://msdn.microsoft.com/en-us/library/yx7xezcf(VS.71).aspx

FYI - I believe it is recommended that you don't reference assemblies which are in physically in the GAC, and that you instead reference the strongly named assembly before it is placed in the GAC (not to be confused with whether or not the assembly should be installed to the GAC on the end-user machine)

like image 153
Justin Avatar answered Dec 17 '22 07:12

Justin