Search code examples
c#visual-studio-2015sgen

SGEN (x86): Tells me .NET4.6 is required


I've installed Visual Studio 2015 and am trying to upgrade our (32bit) VS2010 projects. When the project compiles, it tries to run SGEN (Generate Serialization Assembly=on) from

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\sgen.exe

Either from the command line, or in visual studio, this window appears and no command line options presented for sgen:

enter image description here

This is .NET 4.6 installed as part of VS2015 (release). I can run 32bit .Net 4.6 assemblies, so it has been installed.

Using 'repair' on the .Net4.6 installation did not fix the problem or report any problems. The registry keys for .NET x86 and x64 appear to be sound (and the same version).

Logged in Microsoft Connect


Solution

  • It turns out it was entirely our fault.

    As part of our upgrade, our build environment notes told us to add a .config file to sgen which we adapted for .net 4.6:

    <configuration>
    <runtime>
        <loadFromRemoteSources enabled="true" />
    </runtime>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.6"/>
    </startup>
    </configuration>
    

    Removing this explicit supportedRuntime tag fixed the issue.