Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programmatically find ILASM.EXE in .NET 4.0?

Tags:

.net

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?

like image 375
Jonathan Allen Avatar asked Feb 27 '11 06:02

Jonathan Allen


1 Answers

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.

like image 62
John K Avatar answered Sep 26 '22 15:09

John K