Running .NET 3.5 to build mixed mode in .NET 4 using application configuration also requires Framework 3.5

This is similar to a stream already created: Mixed mode assembly in .NET 4

Using the application configuration, I managed to get the assemblies to work on .NET 4. On the XP machine, I installed only .NET 4 (without .NET 3.5 or 2.0) and tried to run the embedded application. It cannot load the mixed-mode assembly built in the 3.5 framework in .NET 4, without the .NET 3.5 framework on the machine.

Why should this depend on .NET 3.5 when I force the application to run on .NET 4 using the App config?

+4
source share
2 answers

You are having this problem because .NET 3.5 uses the CLR version 2 and .NET 4.0 runs on CLR v4. Therefore, if your assembly was built in .NET 3.5, it will only work on a computer with CLR v2.

Shortly speaking. Compile the .NET 3.5 assembly as the .NET 4 assembly; otherwise, install .NET 3.5 on the target computer.


You can see this site for more information:

+3
source

The reason is because the way to bind to mixed-mode assemblies. Make sure you use the useLegacyV2RuntimeActivationPolicy = "true" parameter in the launch configuration of your app.config file (which, I believe, looks like the following):

<startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0.30319" /> <supportedRuntime version="v2.0.50727" /> </startup> 

See also: What does useGegacyV2RuntimeActivationPolicy do in a .NET 4 configuration?

+3
source

All Articles