My program needs to call ILASM
, but it keeps moving on me. Is there a registry setting or some other value that my program can read so I don't need to hard code the path?
From the SDK Microsoft.Build.Utilities namespace, the ToolLocationHelper class can be used like so:
using Microsoft.Build.Utilities;
// Use ToolLocationHelper to find ILASM.EXE in the Framework directory
ToolLocationHelper.GetPathToDotNetFrameworkFile("ILAsm.exe", TargetDotNetFrameworkVersion.VersionLatest);
Taken from MSDN sample .
There seem to be a few libraries that are like ILAsm that people have recommended:
You might want to use those (or CodeDom -> C#) instead of calling out to a program.
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft.NETFramework, look for InstallRoot. Add the .net version number to the path in InstallRoot and you've got it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.