"This assembly is built using a runtime that is newer than the currently loaded runtime and cannot be loaded."

I get an error: "This assembly was built using a runtime that is newer than the currently loaded runtime and cannot be loaded."

I have a dll.NET 4.0 project that is called by a .NET 2.0 project. Is there any way to reconcile the difference in structure?

+51
May 15 '12 at 18:57
source share
11 answers

I have a dll.NET 4.0 project that is called by a .NET 2.0 project. Is there any way to reconcile the difference in structure?

Not so, all around, no..NET 4 CLR can load .NET 2 assemblies (usually there are a few exceptions for mixed-mode collectors, IIRC), but not vice versa.

You need to either upgrade your .NET 2 project to .NET 4, or upgrade your .NET 4 project to .NET 3.5 (or earlier).

+46
May 15 '12 at 18:59
source share

I have the same error message. I gave

C: \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \ InstallUtil.exe "C: \ MyService \ MyService.exe"

Instead

C: \ WINDOWS \ Microsoft.NET \ Framework \ v4.0.30319 \ InstallUtil.exe "C: \ MyService \ MyService.exe"

+8
Sep 11 '15 at 18:50
source share

If you have already tried all the other logical solutions on this page, double check this. In my app.config, I had a link to the old structure.

<startup> <supportedRuntime version="v2.0.50727"/> </startup> 

should be

 <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> 

The project tab showed v4.0 correctly, but app.config was not tied to our repo with this change. To fix this, I changed the framework to something else and again on 4.0, updating the app.config file.

+8
Jun 13 '16 at 20:57
source share

Since only one version of the runtime can be loaded into the process (although, as others have pointed out, reverse loading - loading 4.0 - this is normal), you have several options:

  • Update .Net 2.0 Project
  • Wrap a .Net 2.0 project (if the source does not belong to you)
  • Reduce .Net 4.0 Project
  • Download the .Net 4.0 project to your own process (I believe this might work - but we’ll put a little effort, IMO)
+5
May 15 '12 at 19:04
source share

You need to either upgrade your .NET 2 project to .NET 4, or upgrade your .NET 4 project to .NET 3.5 (or earlier).

How to upgrade .net version? I am not sure where and what to indicate. Please, help.

Edit: I myself found the answer. Select the project, right-click and select Property Pages. There you can choose the version of the framework. or select a project and press Shift + F4

+5
Jan 25 '13 at 12:09
source share

Interestingly, I kept getting this error. For me, this created the gacutil.exe.config configuration in the same directory as gacutil.exe. Configuration contents (text file):

 <?xml version ="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/> </startup> </configuration> 

I post this here for reference and ask if anyone knows what is really happening under the hood. I am not saying that this is the “right” way to do this.

+3
May 12 '16 at 22:43
source share

change the INSTALL_UTIL_HOME directory from "C: \ WINDOWS \ Microsoft.NET \ Framework \ v2.0" to "C: \ WINDOWS \ Microsoft.NET \ Framework \ v4.0.30319" to install the service. This error occurs mainly for the missmatch version.

+2
Sep 07 '15 at 8:49
source share

I also got this error, but the problem was that I was using an older version of GACUTIL.EXE .

Once I had the correct GACUTIL for the latest .NET version, it worked fine.

The error is misleading because it looks like a DLL that you are trying to register incorrectly.

+2
Dec 17 '15 at 19:02
source share

This error can also be caused by the fact that the wrong version of the .NET platform is selected as the default value in IIS.

Click on the root node directory in the Connections window (left), then select "Change .NET Framework Version" in the Actions view (right), then select the appropriate .NET version from the drop-down list.

+1
Aug 22 '16 at 23:23
source share

Version mismatch .net DLL, so try switching to app.config or web.config. As a rule, they have a higher structure than lower, because when we add the system DLL to a lower version of the embedded .net application, therefore it will not work, so just change it to a higher version

0
Apr 04 '16 at 10:14
source share

The error is related to how I configured the application pool in IIS.

My web service uses an application configured for v2.0.50727. This led to an error message.

When I changed it to v4.0.30319, I did not receive an error.

0
Aug 11 '17 at 15:45
source share



All Articles