[英]How do I programmatically find ILASM.EXE in .NET 4.0?
My program needs to call ILASM
, but it keeps moving on me. 我的程序需要调用
ILASM
,但它继续向我发展。 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: 从SDK Microsoft.Build.Utilities命名空间,可以像这样使用ToolLocationHelper类 :
using Microsoft.Build.Utilities;
// Use ToolLocationHelper to find ILASM.EXE in the Framework directory
ToolLocationHelper.GetPathToDotNetFrameworkFile("ILAsm.exe", TargetDotNetFrameworkVersion.VersionLatest);
Taken from MSDN sample . 取自MSDN样本 。
There seem to be a few libraries that are like ILAsm that people have recommended: 似乎有一些库像人们推荐的ILAsm:
You might want to use those (or CodeDom -> C#) instead of calling out to a program. 您可能希望使用这些(或CodeDom - > C#)而不是调用程序。
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft.NETFramework, look for InstallRoot. HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft.NETFramework,查找InstallRoot。 Add the .net version number to the path in InstallRoot and you've got it.
将.net版本号添加到InstallRoot中的路径,您就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.