Resolving A. NET 2.0 application cannot run problems under. NET Framework 4.0

Source: Internet
Author: User

The. NET Framework 4.0 is installed on the computer, and the. NET 2.0 application is running an error:





Find instructions in MSDN:

Reference content

The. NET Framework 4 does not automatically use its own version of the common language runtime to run applications built from earlier versions of the. NET Framework. To run an older application using the. NET Framework 4, you must compile the application using the target. NET Framework version specified by the properties of the project in Visual Studio, or use the <supportedruntim in the application configuration file The e> element can specify the supported runtime.

. NET 2.0 applications cannot run a workaround under. NET Framework 4.0

Open app.config and add the bottom content:


<?xml version= "1.0" encoding= "Utf-8"?>
<configuration>
<startup>
<supportedruntime version= "v2.0.50727"/>
<supportedruntime version= "v4.0"/>
</startup>
</configuration>

Supportedruntime is used to specify the version of the common language runtime supported by the application, which indicates that the application can run under the. NET Framework 2.0 and. NET Framework 4.0.

For the Version property value, the first three versions of the CLR are specified by "v1.0.3705", "v1.1.4322", and "v2.0.50727", starting with the. NET Framework version 4, only the major and minor version numbers are required (that is, "v4.0" instead of " v4.0.30319 ").

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.