GEN - Directing a .net assembly to use a different runtime
Brian Donahue
Posts: 6,590 Bronze 1
It is possible to install many different versions of Microsoft .net Framework on the same computer. These side-by-side installations can cause problems, especially if features of the Framework had been added or dropped. Getting an application to behave as intended may require a few small modifications to the system to get the application to use the correct version of the Framework.
By default, an application written for Microsoft .net will use the version that it was written for. For instance, if an application was developed in Visual Studio .net 2002, the application would use .net Framework 1.0 if that version was installed on the machine. If the machine had versions 1.0 and 1.1 installed, the application would use 1.0. If the machine has versions 1.1 and 2.0 installed, however, the application will automatically switch to the newest version and use Framework 2.0.
If the application ran under Framework 1.1 and Framework 2.0 introduces problems with the application, you may want to ‘force’ the application to use version 1.1. Because the behaviour of the application normally is to use the newest version of Framework if the specified version does not exist, you need to point the application at a particular version of .net Framework by constructing a configuration file.
To create a configuration file, first open Notepad.exe (or any text editor) and enter the following lines:
<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
</configuration>
Now, save this file in the application’s working directory with the same name as the assembly and “.config†appended to the end. For example, to change the supported runtime of ANTS Profiler, you would name the file RedGate.ANTSProfiler.UI.exe.config.
The application assembly will now use the .net Framework version 1.1 instead of the default version.
By default, an application written for Microsoft .net will use the version that it was written for. For instance, if an application was developed in Visual Studio .net 2002, the application would use .net Framework 1.0 if that version was installed on the machine. If the machine had versions 1.0 and 1.1 installed, the application would use 1.0. If the machine has versions 1.1 and 2.0 installed, however, the application will automatically switch to the newest version and use Framework 2.0.
If the application ran under Framework 1.1 and Framework 2.0 introduces problems with the application, you may want to ‘force’ the application to use version 1.1. Because the behaviour of the application normally is to use the newest version of Framework if the specified version does not exist, you need to point the application at a particular version of .net Framework by constructing a configuration file.
To create a configuration file, first open Notepad.exe (or any text editor) and enter the following lines:
<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
</configuration>
Now, save this file in the application’s working directory with the same name as the assembly and “.config†appended to the end. For example, to change the supported runtime of ANTS Profiler, you would name the file RedGate.ANTSProfiler.UI.exe.config.
The application assembly will now use the .net Framework version 1.1 instead of the default version.