Issue with ValueTuple on net471
jcouv opened this issue ยท 9 comments
@terrajobst @ryanelian If it's ok, let's move the investigation to a dedicated issue.
Here's the latest comment from Ryan, in the thread for #514.
btw, just curious, how do you 'see' the content of the binary log?
No, adding those lines does not make the warning message disappear...
.NET Command Line Tools (2.0.2)
Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512
Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.2\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
As I'm also victim of the ValueTuple problems and the Binding Warnings, this might help as it contains a repro for the binding warnings, dotnet/project-system#2905
it includes ValueTuple and several other System libraries.
I have an issue with 4.7.1 and ValueTuple too but it is a little bit different.
I wanted to target my project to 4.7.1 but it doesn't build anymore. Here are the build errors:
[CS8137] Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found. Are you missing a reference?
[CS8356] Predefined type 'System.ValueTuple`2' is declared in multiple referenced assemblies: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
I understand that is caused by having two references which hold ValueTuple type. The solution would be to uninstall ValueTuple NuGet package but I am not able to do it. I have references to other libraries targeting 4.6.2 and having dependences on ValueTuple NuGet package.
Is there any workaround until the dependent packages are upgraded to 4.7.x too?
@marisks are you using the latest version of the System.ValueTuple package? I would expect the latest one to typeforward the type down to mscorlib for net471 in order to avoid the conflicts.
Now I have ValueTuple 4.4.0 installed.
do you have a simple repro that I can take a look at? If not, then can you produce at least a binlog and share it? To produce a binlog simply build your project through the command line like: msbuild yourProject.csproj /bl /t:rebuild
Is there any workaround for this? I just ran into it upgrading a project to .NET 472 with ValueTuple 4.5.0. Nearly a year later I would have assumed this has been fixed.
Running into this as well, I have ValueTuple 4.5.0 (the latest), which I can't uninstall because I'm using a library that targets 4.6 (Automapper). Getting this error after trying to target 4.7.2.
I'm not able to paste the entire binlog, but I pulled out all the parts that mention ValueTuple:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL' and 'Platform:System.ValueTuple.dll'. NETSDK1033: Choosing 'Reference:System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL' because AssemblyVersion '4.0.3.0' is greater than '4.0.2.0'. [C:\dev\oap\MyProject\MyProject.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Platform:System.ValueTuple.dll' and 'Reference:System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL'. NETSDK1033: Choosing 'Reference:System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL' because AssemblyVersion '4.0.3.0' is greater than '4.0.2.0'. [C:\dev\oap\MyProject\MyProject.csproj]
long resgen line contains this flag
/r:C:\dev\oap\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll /
long csc line contains this flag
/reference:C:\dev\oap\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll /
Lib\LayoutEngine\LayoutEngine2.cs(3764,17): error CS8356: Predefined type 'System.ValueTuple`2' is declared in multiple referenced assemblies: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [C:\dev\oap\MyProject\MyProject.csproj]
Done Building Project "C:\dev\oap\MyProject\MyProject.csproj" (rebuild target(s)) -- FAILED.
"C:\dev\oap\MyProject\MyProject.csproj" (rebuild target) (1) ->
(CoreCompile target) ->
Lib\LayoutEngine\LayoutEngine2.cs(3764,17): error CS8356: Predefined type 'System.ValueTuple`2' is declared in multiple referenced assemblies: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [C:\dev\oap\MyProject\MyProject.csproj]
2 Warning(s)
1 Error(s)
There are some workarounds at the bottom of this issue: seesharper/LightInject#447
I used Update-Package -Reinstall
, which managed to fix my app after I removed some of the extra stuff it added to my Web.Config.
I believe this issue is a duplicate of many others we've been seeing related to binding redirects - see https://github.com/dotnet/corefx/issues/32561#issuecomment-428138193 for a list of relevant issues where you should be able to find guidance on how to work around it.