How to: Specify a .NET Framework Version For Debugging
The Visual Studio 2012 debugger supports debugging older versions of the Microsoft .NET Framework as well as the current version. If you start an application from Visual Studio, the debugger can always identify the correct version of the .NET Framework for the application you are debugging. If the application is already running and you use Attach to, the debugger may not always be able to identify an older version of the .NET Framework. If this happens, you will get an error message that says,
The debugger has made an incorrect assumption about the .NET Framework version your application is going to use.
In these rare cases, you can set a registry key to indicate to the debugger which version to use.
To specify a .NET Framework version for debugging
Look in the directory Windows\Microsoft.NET\Framework to find the versions of the .NET Framework installed on your machine. The version numbers look something like this:
V1.1.4322
Identify the correct version number and make a note of it.
Start the Registry Editor (regedit).
In the Registry Editor, open the HKEY_LOCAL_MACHINE folder.
Navigate to: HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{449EC4CC-30D2-4032-9256-EE18EB41B62B}
If the key does not exist, right-click HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\10.0\AD7Metrics\Engine, and click New Key. Name the new key {449EC4CC-30D2-4032-9256-EE18EB41B62B}.
After navigating to {449EC4CC-30D2-4032-9256-EE18EB41B62B}, look in the Name column, and find the CLRVersionForDebugging key.
- If the key does not exist, right-click {449EC4CC-30D2-4032-9256-EE18EB41B62B}, and click New String Value. Then right-click the new string value, click Rename, and type CLRVersionForDebugging.
Double-click CLRVersionForDebugging.
In the Edit String box, type the .NET Framework version number in the Value box. For example: V1.1.4322
Click OK.
Close the Registry Editor.
If you still get an error message when you start to debug, verify that you have entered the version number correctly in the registry. Also verify that you are using a version of the .NET Framework supported by Visual Studio. The debugger is compatible with the current .NET Framework version and previous versions, but may not be forward compatible with future versions.