Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force an application to run under specific .NET runtime version?

Tags:

.net

I have .NET 2.0 runtime installed, then I installed the .NET 4.0 runtime, so I have both. When I run a .NET app, is there a way to force which runtime will be used?

Edit/Clarification: I meant w/o regards to how the application was built. I am under the assumption that the .NET 4.0 runtime can run a .NET program compiled 5 years ago that targeted the 2.0 runtime (oldprogram.exe). So now I am on a machine with both runtimes, either of which could handle oldprogram.exe. Which runtime is chosen? Can I influence which runtime is chosen?

like image 904
noctonura Avatar asked Jan 12 '10 01:01

noctonura


People also ask

Is .NET Framework same as .NET runtime?

NET Framework are the Common Language Runtime and the . NET Framework Class Library. The Common Language Runtime (CLR) is the execution engine that handles running applications.

How do I fix unable to find a version of the runtime to run this application?

You may try to uninstall and reinstall the latest version of . net framework and check. Ignore the error message, perform the resolution provided in the article.


1 Answers

Yes, use the <supportedRuntime> element in the .exe.config file. For example:

<configuration>    <startup>       <supportedRuntime version="v2.0.50727"/>    </startup> </configuration> 
like image 82
Hans Passant Avatar answered Nov 11 '22 01:11

Hans Passant