|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Running a C++ /clr Application on a Previous Runtime Version
Unless otherwise specified, a Visual C++ .NET application is built to run with the common language runtime version that the compiler uses to build the application. However, it is possible for an .exe application built with one version of the runtime to run on any other version of the runtime that provides all of the necessary functionality.
To accomplish this, an .exe application needs an app.config file containing runtime version information (with the supportedRuntime tag). The Visual C++ development environment does not support modification of the app.config file, but other Visual Studio languages do through the project's Property Pages dialog box. For example, you can modify the Supported Runtimes property of a Visual C# Windows application and use that updated app.config file in your C++ application.
At run time, the name of the app.config file must be filename.ext.config (where filename.ext is the name of the executable that started the application) and the file must be in the same directory as the executable. For example, if your application is called TestApp.exe, the app.config file would be named TestApp.exe.config.
If you specify more than one runtime version and the application runs on a computer with more than one installed runtime version, the application uses the first version specified in the config file that matches an installed runtime that is available on the system.
For more information, see Targeting a .NET Framework Version.
Windows applications built with the Visual C++ compiler need to be compiled with /clr:initialAppDomain to run on the previous version of the common language runtime.
Targeting the previous version of the runtime for ASP.NET Web applications is not supported in this release of Visual C++.