Mixed mode assembly is built against version 'v1.1.4322'
You need to add an app.Config file and set useLegacyV2RuntimeActivationPolicy
to true.
This is required to use mixed mode CLR 2 assemblies in a .NET 4 application.
Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot
I figured out my problem. It turns out it had to do with the framework that I was using. I thought that my service exe was myservice.exe so I named my config file myservice.exe.config. Upon further investigation, I found out that the service was inheriting from a base service class and that the executable was named serviceshell.exe so my config file needed to be named serviceshell.exe.config.
Mixed mode assembly is built against version X and cannot be loaded in version Y of the runtime without additional configuration information
I got the project to compile by changing 'Generate Serialization Assemblies' from 'Auto' to 'Off' in my app's configuration. The advice all over the internet about useLegacyV2RuntimeActivationPolicy seemed to be a red herring for my situation.
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime
Make sure you have configured both the App.config and the ProgramName.exe.config file.
For example:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Mixed mode assembly is built, after upgrade to windows 10
You should not need recompile app. Should suffice add yourapp.exe.config to same folder with:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>
or add to existing config.
if that does not work and you do not have source code, you can decompile app to IL code by
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools>ildasm.exe D:\Temp\yourapp.exe /output:D:\Temp\yourapp\yourapp.il
repair runtime version in IL and then compile it
C:\Windows\Microsoft.NET\Framework\v4.0.30319>ilasm.exe D:\Temp\yourapp\yourapp.il /output:D:\Temp\yourappPatch.exe
How find which dll is causing: Mixed mode assembly built against version ... cannot be loaded in 4.0 runtime?
I resolved this as follows.
Visual Studio 2015 - Tools / Options / Projects and Solutions / Build and Run:
MSBuild project build output verbosity:
Detailed.From Output (Build), copy paste all the text into Notepad++. Find very long line with "sgen.exe". This is worthwhile in itself, as it shows all referenced dlls, with their full paths.
Run Command prompt, try variations of that "sgen.exe" line, omitting various
/reference ...
parameters.
RESULT:
Most references could be included, without causing "mixed mode" error.
All the third-party dlls I had suspected do not cause this error.
Discovered the problem was the Microsoft.DirectX.* dlls!
FIX:
Switch to SharpDX
.
Change references from Microsoft.DirectX.Direct3D
to SharpDX.Direct3D11
(or SharpDX.DirectX9
, etc.)
(I was going to do this later, to go to 64-bits; had not realized I needed to do this just to get to .NET 4.5+)
Related Topics
How to Bring Up the Built-In File Copy Dialog
Use Dependency Injection in Static Class
Curiously Recurring Template Pattern and Generics Constraints (C#)
Changing Font for Richtextbox Without Losing Formatting
Queuing in Oneway Wcf Messages Using Windows Service and SQL Server
How to Read Data from Excel File Using C#
How to Select Only the Records with the Highest Date in Linq
Object Reference Not Set to an Instance of an Object
How Is Memory Allocated for a Static Variable
How to Read/Stream a File Without Loading the Entire File into Memory
A Dictionary Object That Uses Ranges of Values for Keys
Async and Await - Difference Between Console, Windows Forms and ASP.NET
Converting ASP.NET MVC Razor @Helper Function into a Method of a Helper Class
Sending an Array of Values to Oracle Procedure to Use in Where in Clause
What Difference Is There Between Webclient and Httpwebrequest Classes in .Net