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.

vezenkov
  • 4,009
  • 1
  • 26
  • 27
  • 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. – Frédéric Sep 18 '15 at 09:04
  • Yeah, better wait - before you break your build process :) – vezenkov Sep 18 '15 at 09:10
  • 1
    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. – Hans Passant Sep 18 '15 at 12:27
  • You can just configure your deploy script to delete anything you don't want – Vlad Sep 18 '15 at 17:04
  • 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. – vezenkov Sep 23 '15 at 18:34
  • 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. – vezenkov Sep 23 '15 at 18:38
  • 1
    I have found some solution here at Microsoft Connect site: https://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! – GigaKatowice Aug 08 '16 at 09:21

1 Answers1

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>
ninja coder
  • 1,067
  • 9
  • 22
  • 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. – ninja coder Nov 14 '16 at 01:40