sdk: .NET 4.6.1 project cannot reference a .NET Standard 1.4 project - conflicting types

Repro: https://github.com/gulbanana/repro-netstandard-httpclient These two projects were created with VS2017 RC Refresh. Neither contains any meaningful code. netstdlib builds ok, but netfxlib fails:

banana@forsyth MINGW64 /c/code/repro-netstandard-httpclient/netfxlib (master)
$ dotnet build
Microsoft (R) Build Engine version 15.1.458.808
Copyright (C) Microsoft Corporation. All rights reserved.

  netstdlib -> C:\code\repro-netstandard-httpclient\netstdlib\bin\Debug\netstandard1.4\netstdlib.dll
C:\Program Files\dotnet\sdk\1.0.0-preview4-004233\Microsoft.Common.CurrentVersion.targets(1909,5): warning MSB3243: No way to resolve conflict between "System.IO.Compression, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System.IO.Compression, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily. [C:\code\repro-netstandard-httpclient\netfxlib\netfxlib.csproj]
C:\Program Files\dotnet\sdk\1.0.0-preview4-004233\Microsoft.Common.CurrentVersion.targets(1909,5): warning MSB3243: No way to resolve conflict between "System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily. [C:\code\repro-netstandard-httpclient\netfxlib\netfxlib.csproj]
  Consider app.config remapping of assembly "System.IO.Compression, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.IO.Compression.dll] to Version "4.1.0.0" [C:\Users\banana\.nuget\packages\system.io.compression\4.1.0\ref\net46\System.IO.Compression.dll] to solve conflict and get rid of warning.
  Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll] to Version "4.1.0.0" [C:\Users\banana\.nuget\packages\system.net.http\4.1.0\ref\net46\System.Net.Http.dll] to solve conflict and get rid of warning.
Class1.cs(9,29): error CS0433: The type 'HttpClient' exists in both 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [C:\code\repro-netstandard-httpclient\netfxlib\netfxlib.csproj]

Warnings are present even if you don’t add a line of code to either project, and if you try to use any types from System.IO.Compression or System.Net.Http it’s an unfixable compile error.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

When will this fix land?

Also getting this with a brand new project. Library targeting .NETStandard1.6 Tests for the library targeting .NET4.6.1 Windows 10, VS2015.3, .NET Core 1.1.0 SDK 1.0.0 Preview 2.1, .NET Core 1.0.1 VS 2015 tooling Preview 2

Edit: I can continue for now by going down to 1.4.

referencing netstandard.lib on desktop needs to be made ok to do, as it will become harder and harder to avoid. unfortunately the status quo is that you must avoid it due to issues such as the webrequest inheritance security thing. i think the exacerbating factors with new csproj are twofold:

  1. default assembly refs cause immediate clashes
  2. binding redirects are no longer a workaround option

but the fundamental underlying cause is the same. a desktop-safe release of netstandard.library is needed asap - we cannot wait for the 2.0 timeframe!