Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

VS2015/VS2013 build broken when NuGet package is installed using VS2017.3 #467

Closed
oatkins opened this issue Aug 23, 2017 · 11 comments
Closed

Comments

@oatkins
Copy link

oatkins commented Aug 23, 2017

This is related to #454, but not exactly the same.

We have a large .NET 4.6.2 Windows desktop application with many developers. Some are using VS2017, but many are still on VS2015 or 2013. When a developer working in VS2017 adds a reference to the latest version of System.Collections.Immutable, the project can no longer be built by older versions of Visual Studio. We see many errors like:

The type 'System.Collections.IStructuralEquatable' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

Installing NETStandard.Library.NETFramework does resolve the problem, but since the package is marked as a preview, it causes other build warnings when we try to generate NuGet packages from our projects.

This leaves us with three options, none of which is very appealing:

  • Always add NuGet packages using VS2015. (We would prefer that developers do not need multiple versions of VS to be installed.)

  • Have all developers install VS2017, even if they continue to develop in VS2013. (They can't: they don't have licenses.)

  • Install the NETStandard.Library.NETFramework preview package in all our projects and try to find a way to suppress the warnings.

Am I missing any better alternative?

@oatkins
Copy link
Author

oatkins commented Aug 23, 2017

The following is a minimal repro of a solution that builds fine in VS2017 but not in VS2013.

TestNetStandardNugetPackage.zip

@dasMulli
Copy link

For Visual Studio 2015 there is a NuGet 3.6.0 VSIX at https://www.nuget.org/downloads that tells me to download the VS 2015 support from https://download.microsoft.com/download/0/F/D/0FD852A4-7EA1-4E2A-983A-0484AC19B92C/dotnet-standard-support-vs2015-2.0.0-win-x86.msi (though via an aka.ms link that I now no longer have in my clipboard)

However, giving this a try on that solution yields compile errors for conflicting references like this:

CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\MSBuild\Microsoft\Microsoft.NET.Build.
Extensions\net461\ref\System.Xml.XmlSerializer.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades
\System.Xml.XmlSerializer.dll'. Remove one of the duplicate references. [C:\Users\martin.ullrich\Downloads\TestNetStandardNugetPackage\TestNetStandar
dNugetPackage\TestNetStandardNugetPackage.csproj]

Same thing happens when creating a new .NET 4.6.1 console application in VS 2017 and adding a netstandard2.0 package (e.g. Microsoft.Extensions.Logging.Console).

Heres the diagnostic log of the build: msbuild.log.zip

cc @ericstj @dsplaisted - this is probably an sdk issue?

@ericstj
Copy link
Member

ericstj commented Aug 23, 2017

It looks like MSBuild is still adding the facades from the targeting pack. I haven't chased down the diff yet, but you should be able to workaround by setting ImplicitlyExpandDesignTimeFacades=false.

@ericstj
Copy link
Member

ericstj commented Aug 23, 2017

I believe the diff is this: dotnet/msbuild@40cd4d0

Indeed this is an SDK issue.

@ericstj
Copy link
Member

ericstj commented Aug 25, 2017

Closing here as @dasMulli opened this in the SDK. (thanks!)

@ericstj ericstj closed this as completed Aug 25, 2017
@oatkins
Copy link
Author

oatkins commented Aug 25, 2017

OK, though still a bit stuck about how we'll help those VS2013 users :-(

@ericstj
Copy link
Member

ericstj commented Aug 25, 2017

We're not stuck, we're just going to fix it in the repo that builds the component that has the problem. @oatkins please follow dotnet/sdk#1539.

@oatkins
Copy link
Author

oatkins commented Aug 25, 2017 via email

@ericstj
Copy link
Member

ericstj commented Aug 25, 2017

The SDK is what's delivering these targets to all versions of VS: 2013/2015/2017. The bug exists because the 2013/2015 msbuild targets didn't handle duplicates during the ImplicitlyExpandDesignTimeFacades target. The workaround here should work for both 2013/2015 and I expect the fix in the SDK to address both as well.

@oatkins
Copy link
Author

oatkins commented Aug 25, 2017 via email

@dasMulli
Copy link

But I guess a nuget 2.* update would be necessary to know about the ns2.0 => net461 mapping? - at least if you want to add/update packages

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants