Getting reflector to run using the correct runtime
My DSM Plugin for .NET uses some features of .Net framework v2 so it requires v2 of the runtime installed on the same machine. However on a friend’s machine we couldn’t get the plugin to work even though v2 was installed – Reflector kept running under v1 of the framework and so wouldn’t load my plugin. At first we didn’t understand as I had v1 and v2 of the framework installed as he did – it worked on my system but not his. As it turned out he had in fact 3 versions of the runtime installed: 2.0.50727, 1.1.4322 and 1.0.3705 (the version that I did not have). If you look at Reflector using Reflector you’ll see in the dissasembler that the target runtime is in fact V1.0.3705 :
.module Reflector.exe
.subsystem 0x0002
// MVID: {7C02BB23-FFA9-4C2E-95DB-BFE25D262FFD}
// Target Runtime Version: v1.0.3705
When a .NET application runs it will use the target runtime version specified in the assembly manifest if that version of the runtime is installed on the system. If it is not, the application will run under the most recent version. So how do we get Reflector to work with plugins that require V2 even though v1.0.3705 is installed ?
Well it turns out to be quite simple as we can bypass the default runtime selection behaviour and tell reflector which runtime to use. So if you have v1.0.3705 installed on your system you need to create a file in the same directory as Reflector.exe called Reflector.exe.cfg with the following content as shown below. This tells Reflector to run (in order of preference) v2.0.5077 if installed, else v1.1.4322 if installed, else v1.0.3705
<?xml version="1.0" ?> <configuration> <startup> <supportedRuntime version="v2.0.50727" /> <supportedRuntime version="v1.1.4322" /> <supportedRuntime version="v1.0.3705" /> </startup> </configuration>
More info can be found on MSDN
Filed under: .NET, DSM | Leave a Comment
No Responses Yet to “Getting reflector to run using the correct runtime”