SGEN: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information


Symptoms


You may recieve the following error when building .NET 3.5 or lower projects on .NET 4.0 Msbuild or team build where references requires SGEN:


SGEN: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

Cause


In order to used mixed mode assemblies in 4.0, it must be configured in configuration file for Sgen

Resolution


Add the infomation below to the sgen.exe.config file located at the following location: ..\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\

<?xml version ="1.0"?>

<configuration>

    <startup useLegacyV2RuntimeActivationPolicy="true">

                <supportedRuntime version="v4.0" />

    </startup>   

</configuration>