How to programmatically find ILASM.EXE in .NET 4.0?

My program should call ILASM , but it continues to move through me. Is there a registry setting or other value that my program can read, so I don’t need to hardcode the path?

+6
source share
3 answers

In the Microsoft.Build.Utilities SDK namespace, you can use the ToolLocationHelper class :

 using Microsoft.Build.Utilities; // Use ToolLocationHelper to find ILASM.EXE in the Framework directory ToolLocationHelper.GetPathToDotNetFrameworkFile("ILAsm.exe", TargetDotNetFrameworkVersion.VersionLatest); 

Adapted from the MSDN sample .

+5
source share

It seems that there are several libraries that look like ILAsm that people have recommended:

You can use these (or CodeDom β†’ C #) instead of calling the program.

+2
source share

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft.NETFramework, find InstallRoot. Add the .net version number to the path in InstallRoot and get it.

+1
source share

All Articles