Skip to content

Instantly share code, notes, and snippets.

@duncansmart
Last active April 24, 2017 10:23
Show Gist options
  • Save duncansmart/929f4932a17ce68f62a7fd1ec2cae845 to your computer and use it in GitHub Desktop.
Save duncansmart/929f4932a17ce68f62a7fd1ec2cae845 to your computer and use it in GitHub Desktop.
Windows 10 CU ValueTuple hack

Define an environment variable called Windows10CUFix with value = 1

In proj file locate <Reference Include="System.ValueTuple... and replace with following:

<Reference Condition=" '$(Windows10CUFix)' == '' " Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
    <HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Condition=" '$(Windows10CUFix)' != '' " Include="mscorlib">
    <HintPath>$(WINDIR)\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll</HintPath>
</Reference>

What it does is conditionally exclude ValueTuple nuget reference and pulls in mscorlib instead.

In cshtml pages Visual Studio will get confused when it come across tuple syntax with "Reference to type 'ValueTuple<,>' claims it is defined in mscorlib, but it could not be found" - to fix this, tweak web.config by changing/setting <system.web> <compilation targetFramework="4.7">

 <system.web>
    <compilation ... targetFramework="4.7">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment