Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixed mode assembly is built against 'v2.0.50727' error

First of all, I've found the other posts on StackOverflow here, but it did not resolve my error.

I have 3 different environments/domains with a build server in each location. My Dev and UAT environments build just fine, but the production version does not work.

I'm getting the error

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

I've added this tag to my app.config file (which was the suggested fix in the link I have above)

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>

What else could be different between my build servers/environments/domains that would be causing this issue?

In response to Allen's question, I believe this is what you're asking:

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{D3D87C05-2811-489B-9F0D-7676B6485AA0}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>MVST.Batch.CorrespondenceConversion</RootNamespace>
    <AssemblyName>MVST.Batch.CorrespondenceConversion</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>

I have over 100 other projects that are setup the exact same way and those build ok.

like image 869
ganders Avatar asked Feb 11 '13 15:02

ganders


2 Answers

http://support.microsoft.com/kb/2572158

Add the verbiage useLegacyV2RuntimeActivationPolicy="true" below either to either of the following locations:

  1. sgen.exe.config file located at the following location: ..\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\
  2. The applications' app.config file

<startup useLegacyV2RuntimeActivationPolicy="true">

            <supportedRuntime version="v4.0" />

</startup>    

like image 97
smily Avatar answered Nov 11 '22 11:11

smily


If you're running in 64-bit, you may have to add it to the Visual Studio test engine config:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.exe.config

Add the startup node like so:

<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    <requiredRuntime version="v4.0.20506" />
</startup>
like image 20
Codeman Avatar answered Nov 11 '22 10:11

Codeman