Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly in GAC is not copied to output in project that references a project that references the GAC assembly with CopyLocal=true

I have a "Project A" that references System.Web.Mvc with CopyLocal=TRue. System.Web.Mvc is in the GAC both on my local maching and on the buildserver.

I also have a "Project B" that references "Project A" in the output for "Project B" System.Web.Mvc is not copied to during the build.

I suspect that this is because it is in the GAC. Is this true? And can I do something to make MSBuild copy it to the output folder?

I read the answer from Muse VsExtensions in this thread, which talks about only the direct reference to the GAC, however we have an indirect reference through "Project A": .NET Reference "Copy Local" True / False Being Set Based on Contents of GAC

This blogpost is also related: http://deeperdesign.wordpress.com/2010/02/08/msbuild-assembly-dependencies-and-the-gac/

like image 965
khebbie Avatar asked Nov 24 '11 11:11

khebbie


People also ask

What is copy local in Visual Studio?

Copy Local essentially means I must manually deploy this DLL in order for my application to work. When it's false it essentially means "I depend on another component which must be installed separately or chained, the DLL will just be there already".


2 Answers

Did you check the .csproj file to verify that the reference does indeed contain the <Private>True</Private> tag? Copy local is unfortunately has 3 states in the xml - True, False and ... missing.

like image 175
RasmusKL Avatar answered Sep 30 '22 18:09

RasmusKL


A pragmatic (read hack) solution is that I referenced System.Web.Mvc.dll in "Project B". This is definitively not the right solution, so please bring me a better solution :-)

like image 27
khebbie Avatar answered Sep 30 '22 18:09

khebbie