Unable to return Tuple from a method using Visual Studio 2017 and C# 7.0

前端 未结 4 1413
孤独总比滥情好
孤独总比滥情好 2020-12-08 12:47

I\'ve installed Visual Studio 2017 Community that was released a week ago, and I started exploring the new features of C# 7.

So I created a simple method that return

4条回答
  •  一个人的身影
    2020-12-08 13:24

    I also came accross this issue as I upgraded from .NET 4.6.2 to .NET 4.7.2. Unfortunately, I was not able to remove the package reference to System.ValueTuple because another NuGet package I use depends on it.

    Finally I was able to locate the root cause: There was a .NET 4.6.2 version of mscorlib.dll lying around in the project folder (output of a publish operation) and MSBuild decided to reference this assembly instead of the official .NET 4.7.2 reference assembly located in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2.

    Due to the fact that System.ValueTuple was introduced in .NET 4.7, MSBuild failed the compilation because it could not find the type in the reference assembly of .NET 4.6.2.

提交回复
热议问题