VS 2015 copies to output GAC references of a project reference regardless of copy local setting
Asked Answered
T

1

11

I've raised a connect issue for that behavior.

VS 2015 copies to output GAC references of a project reference regardless of copy local setting. VS 2010 doesn't do that with the same solution & projects, respecting the copy local property. The only workaround I've found so far is to add a direct reference to Microsoft.Web.Services3.dll in Project A and set it to copy local = false.

Steps to reproduce:

Project A
|__ Project B (Project Reference, copy local = true)
     |__Microsoft.Web.Services3.dll (GAC, copy local = false)

Actual:

Microsoft.Web.Services3.dll is being copied to the output directory of Project A.

Expected:

Microsoft.Web.Services3.dll is not being copied to the output directory of Project A.

Any idea why this happens? The MSDN documentation clearly states that GAC dependencies should not be copied to output and VS 2010 respects that.

Theolatheologian answered 18/9, 2015 at 8:48 Comment(7)
FYI, VS2013 respects that too (at least with my cases). I will probably wait for an update 1 to VS 2015 before migrating to it.Calvano
Yeah, better wait - before you break your build process :)Theolatheologian
You need to find out how MSBuild was able to find that DLL in the first place. It should not be present in B's build directory, looks like it was. Change the MSBuild verbosity to Detailed and post the relevant lines from the trace you get.Audra
You can just configure your deploy script to delete anything you don't wantDrone
Vlad, I prefer to keep my deploy scripts as clean as possible. And by the way I consider MSBuild project files as deploy scripts that have to be even easier to maintain.Theolatheologian
Hans, thanks for your suggestion. I'll do so although I'm sure it's a problem in Visual Studio 2015 and not in a MSBuild target. As described - same solution and projects built with different version of Visual Studio.Theolatheologian
I have found some solution here at Microsoft Connect site: connect.microsoft.com/VisualStudio/Feedback/Details/1804765. It's clearly a MSBuild bug. You should add Services3 as reference to project A and then set copyLocal=false. Hope it helps!Merit
I
2

When I moved from VS2013 to VS2015, I ran into a similar issue with several third party GAC'ed assemblies. The solution for me was to go into each .csproj file and add the following:

<PropertyGroup>
    <DoNotCopyLocalIfInGac>true</DoNotCopyLocalIfInGac>
</PropertyGroup>
Intellectual answered 14/11, 2016 at 1:37 Comment(1)
It seems as though this question was from several months ago. I guess I should check that before responding to questions to are most likely answered elsewhere.Intellectual

© 2022 - 2024 — McMap. All rights reserved.