Forcing your application to use .NET 4
Published 17 December 2012
In order to attach to a process, or to see the assemblies loaded into an application, its assembly must use the .NET 4 CLR.
You can change the CLR version that your application uses without rebuilding it. This allows you to use 'attach to process' on applications compiled against previous versions.
This will only work if you have not hard-coded a reference to a specific version of .NET in your code.
To force your application to use .NET 4:
Locate your application's config file.
The config file is in the same directory as the application's executable, with a .exe.config extension. If your application's executable is named sample.exe, the configuration file will be sample.exe.config.
If the config file doesn't exist, create a new text file and save it in the same directory as the application's executable. Give it the same name as the executable file, but with the .config file extension.
Edit the file and add the XML below.
If the config file already exists, just add the
<supportedRuntime>node inside the
<configuration> <startup> <supportedRuntime version="v4.0"/> </startup> </configuration>
- Run your application as normal. .NET will automatically load the .exe.config file and the application will run against .NET 4.