ANTS Memory Profiler 7

Forcing your application to use .NET 4

To use the 'attach to process' feature in ANTS Memory 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.

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 as C:/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.

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?