简体   繁体   中英

Running .Net 2.0 executable in .Net 4.0 program

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM