user3418730
user3418730

Reputation: 9

SGEN : error : Mixed mode assembly

Can anyone help me im getting this error when im publishing my project on release mode

SGEN : 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.

Please help me im stuck on this issue.

Upvotes: 1

Views: 1881

Answers (2)

elshev
elshev

Reputation: 1573

There is an answer in Microsoft Support (https://support.microsoft.com/en-za/help/2572158/sgen-mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-ru) which says: In order to use mixed mode assemblies in 4.0, it must be configured in the configuration file for Sgen

Resolution

Add the information 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>

For Visual Studio 2017 the path is different and can be like: c:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\

Upvotes: 0

user3418730
user3418730

Reputation: 9

For Build/Publish in Release Mode please follow below step

  1. create a new file as sgen.exe.config
  2. keep below code in that file

<?xml version ="1.0"?> <configuration> <runtime>
<generatePublisherEvidence enabled="false"/>
</runtime> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0"/> </startup> </configuration>

  1. Please keep this file in below path

    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools Folder

    And for x64

    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64 Folder

  2. Now restart Visual Studio
  3. Open Project in Administrator mode and Build/Publish in Release Mode.

Upvotes: -1

Related Questions