ANTS Performance Profiler 10

Forcing your application to use .NET 4

To use the 'attach to process' feature in ANTS Memory Profiler 6 and above, and ANTS Performance Profiler 6 and above, your 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. Note that 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:

  1. Copy the following XML to a new file:

    <configuration>
      <startup>
        <supportedRuntime version="v4.0"/>
      </startup>
    </configuration>
  2. Save the file in the same location as the application's .exe file, adding .config to the .exe's file name. For example, if your application is saved at C:/Program Files/Company/Program/myApplication.exe, you must save the XML file asC:/Program Files/Company/Program/myApplication.exe.config.
  3. Run your application as normal. .NET will automatically load the .exe.config file and the application will run against .NET 4.
  4. While the application is running, you can attach the profilers to it, as for a normal .NET 4 application.

Note: If the *.exe.config file already exists, edit it with an XML editor to add the <supportedRuntime> node.


Didn't find what you were looking for?