Application Configuration to Support .Net Framework 4 or 4.5
All apps that host the common language runtime (CLR) need to start, or activate, the CLR in order to run managed code. Typically, a .NET Framework app runs on the version of the CLR that it was built on, but you can change this behavior for desktop apps by using an application configuration file (sometimes referred to as an app.config file). However, you cannot change the default activation behavior for Windows Store apps or Windows Phone apps by using an application configuration file.
To configure your app to run on the .NET Framework 4 or 4.5
- Add or locate the configuration file for the .NET Framework project. The configuration file for an app is in the same directory and has the same name as the app, but has a .config extension. For example, for an app named MyExecutable.exe, the application configuration file is named MyExecutable.exe.config.To add a configuration file, on the Visual Studio menu bar, choose Project, Add New Item. Choose General from the left pane, and then choose Configuration File. Name the configuration file appName.exe.config. These menu choices are not available for Windows Store app or Windows phone app projects, because you cannot change the activation policy on those platforms.
- Add the
element as follows to the application configuration file:
wherespecifies the CLR version that aligns with the .NET Framework version that your app supports. Use the following strings:
- .NET Framework 1.0: "v1.0.3705"
- .NET Framework 1.1: "v1.1.4322"
- .NET Framework 2.0, 3.0, and 3.5: "v2.0.50727"
- .NET Framework 4 and 4.5 (including point releases such as 4.5.1): "v4.0"
You can add multiple elements, listed in order of preference, to specify support for multiple versions of the .NET Framework.
No comments:
Post a Comment