Fix for CS8179: Predefined type 'System.ValueTuple
2' is not defined or imported` in Razor cshtml files.
Copy to %LOCALAPPDATA%\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportAfter\
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- | |
Copy to %LOCALAPPDATA%\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportAfter\ | |
--> | |
<PropertyGroup> | |
<!-- If we have .NET 4.7 use ValueTuple defined in mscorlib --> | |
<DotNet47Installed Condition=" '$([MSBuild]::GetRegistryValueFromView(`HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.7`, null, `NOT_FOUND`, RegistryView.Registry64))' == '' ">True</DotNet47Installed> | |
<TargetFrameworkVersion Condition="$(TargetFrameworkVersion) == '4.6' And '$(DotNet47Installed)' == 'True'">v4.7</TargetFrameworkVersion> | |
</PropertyGroup> | |
<ItemGroup> | |
<Reference Condition="'$(DotNet47Installed)' == 'True'" Remove="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL" /> | |
<Reference Condition=" '$(DotNet47Installed)' == 'True' " Include="mscorlib"> | |
<HintPath>$(WINDIR)\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll</HintPath> | |
</Reference> | |
</ItemGroup> | |
</Project> |
What's this for? I encounter the problem in mvc project, although I have installed System.ValueTuple through nuget.