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

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).


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>

My problem was regarding the System.Linq library, which isn't supported in .NET framework 2.0. As you can read in comments, I fixed this with using LINQBridge from nuGet. The other problem was, that framework 2.0 does not contain public method Dispose for HashAlgorithm. I solved this with using Clear method. All the other errors were fixed with reinstalling all nuget packages.

链接地址: http://www.djcxy.com/p/21724.html

上一篇: 在Inkscape中,如何通过输入数字来设置控制点的坐标?

下一篇: 如何确定运行我的应用程序所需的最小.NET框架版本