Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine the minimal required .NET framework version to run my app

Tags:

c#

.net

I have written c# console app. .NET Framework is by default set to version 4.5. I want to know if there is a way, to test app with older versions of .NET framework or test, which version of framework app actually needs to run( without regarding targettype framework).

like image 623
n32303 Avatar asked Jul 14 '14 10:07

n32303


People also ask

How do you find out which NET Framework is needed?

The version of .NET Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full.

Which version of .NET Framework should I use?

A cross-platform and open-source framework, . NET Core is best when developing applications on any platform. . NET Core is used for cloud applications or refactoring large enterprise applications into microservices. You should use .

How many .NET Framework do I need?

Whether you need any of them or not depends on what you're running. Most applications out there are still built for . NET 2 to 3.5 so installing 3.5 will cover you for that. I would recommend installing 4 as looking forwards that's what Microsoft want people to be using.

Do I need to install all versions of .NET Framework?

You need to install the . NET Framework to run many apps on Windows. The best versions to install are the latest one and the . NET Framework 3.5 SP1.


1 Answers

You can add some entries to your app.config file to target a particular version of the framework, to override the version that it was built with. Obviously you still need to test that it works with these versions but this allows you to run on different versions of the framework:

<configuration>
  <!-- this is used if they only have net 4 installed-->
  <!--
  <runtime>
    <NetFx40_LegacySecurityPolicy enabled="true"/>
  </runtime>
  -->
  <startup>
    <supportedRuntime version="v2.0.50727"/>
    <supportedRuntime version="v4.0.30319"/>
  </startup>
</configuration>
like image 117
Lee Willis Avatar answered Oct 20 '22 16:10

Lee Willis