强制应用程序在特定的.NET运行时版本上运行? [英] Force an application to run under specific .NET runtime version?

查看:131
本文介绍了强制应用程序在特定的.NET运行时版本上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了.NET 2.0运行时,那么我安装了.NET 4.0运行时,所以我兼得。当我运行一个.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?

编辑/澄清:我的意思是W / O方面的应用程序是如何构建的。我的.NET 4.0运行时可以运行,有针对性的2.0运行时(oldprogram.exe)编制5年前一个.NET程序的假设下。所以,现在我的机器上运行时双方,无论是其中的可以的处理oldprogram.exe。它运行时选择?我可以影响选择哪个运行?

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?

推荐答案

是的,使用< supportedRuntime>在.exe.config文件与元素。例如:

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

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

这篇关于强制应用程序在特定的.NET运行时版本上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆