运行.NET 2.0的可执行文件在.NET 4.0中的程序 [英] Running .Net 2.0 executable in .Net 4.0 program

查看:107
本文介绍了运行.NET 2.0的可执行文件在.NET 4.0中的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行我的程序外部的可执行文件。我的程序被编译在​​.NET 4.0框架,以使其能够在Windows XP上运行。外部应用程序被编译在​​.NET 2.0框架。当我在我的机器上运行这个程序(Windows 7中的.Net 4.5安装)它工作正常,但是当我运行在XP与.net 4.0安装我收到以下错误:找不到一个版本在运行时运行该应用程序我试图修改app.config文件如下,但没有运气:

 < XML版本=1.0&GT?;
<结构>
<启动>
    < supportedRuntime版本=4.0版的SKU =NETFramework,版本= V4.0/>
    < supportedRuntime版本=2.0SKU =NETFramework,版本= V2.0/>
< /启动>
< /结构>
 

有没有其他的方法来解决这个问题呢?

解决方案
  

在一般情况下,你不应该卸载任何版本安装在计算机上的.NET Framework,因为您使用的应用程序可能会依赖于特定的版本,并且该版本被删除可能会断裂。您可以同时加载在一台计算机上有多个版本的.NET Framework。这意味着您可以安装.NET Framework,而无需卸载previous版本。欲了解更多信息,请参阅入门.NET框架。    http://msdn.microsoft.com/en-us/library/bb822049.aspx

I'm trying to run an external executable from my program. My program is compiled on the .Net 4.0 framework in order to enable it to run on Windows XP. The external application is compiled on the .Net 2.0 framework. When I run this program on my machine (Windows 7, .Net 4.5 installed) it works fine, however when I run it in XP with .Net 4.0 installed I get the following error: Unable to find a version of the runtime to run this application. I tried modifying the app.config file as follows, but with no luck:

<?xml version="1.0"?>
<configuration>
<startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    <supportedRuntime version="v2.0" sku=".NETFramework,Version=v2.0"/>
</startup>
</configuration>

Is there any other way to get around this problem?

解决方案

In general, you should not uninstall any versions of the .NET Framework that are installed on your computer, because an application you use may depend on a specific version and may break if that version is removed. You can load multiple versions of the .NET Framework on a single computer at the same time. This means that you can install the .NET Framework without having uninstall previous versions. For more information, see Getting Started with the .NET Framework. http://msdn.microsoft.com/en-us/library/bb822049.aspx

这篇关于运行.NET 2.0的可执行文件在.NET 4.0中的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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