dll_tool gets the location of ildasm.exe from the the values of "sdkInstallRootv1.1" and "sdkInstallRootv2.0" from the registry under "HKLMSOFTWAREMicrosoft.NETFramework".
Unfortunately dll_tool doesn't actually check if these values actually exists in the registry. If they don't exist you get an entry in the combo box that points nowhere. Then you get the "The system cannot find the file specified" since dll_tool tries to run an exe that does not exist.
The contents of the fixed tool.cs
using System.Collections;
using Microsoft.Win32;
using System.IO;
sealed class tools
{
private static tools theTools = null;
public ArrayList IlAsm = new ArrayList();
public ArrayList IlDasm = new ArrayList();
public static tools GetInstance()
{
//create new instance if required
if (theTools == null)
theTools = new tools();
return theTools;
}
private tools()
{
ilTool tool;
string installRoot = null;
//find locations of ildasm and ilasm
RegistryKey reg = Registry.LocalMachine.OpenSubKey("SOFTWAREMicrosoft.NETFramework");
if (reg != null)
{
if (reg.GetValue("sdkInstallRootv1.1") != null)
{
tool = new ilTool();
tool.Path = (string)reg.GetValue("sdkInstallRootv1.1") + "binildasm.exe";
tool.Version = "v1.1";
IlDasm.Add(tool);
}
if (reg.GetValue("sdkInstallRootv2.0") != null)
{
tool = new ilTool();
tool.Path = (string)reg.GetValue("sdkInstallRootv2.0") + "binildasm.exe";
System.Windows.Forms.MessageBox.Show(tool.Path);
tool.Version = "v2.0";
IlDasm.Add(tool);
}
installRoot = (string)reg.GetValue("InstallRoot");
reg.Close();
}
//find ilasm
if (installRoot != null)
{
string[] dirs = Directory.GetDirectories(installRoot);
//search install root for directories than contain ilasm.exe
foreach (string str in dirs)
{
if (File.Exists(str + Path.DirectorySeparatorChar + "ilasm.exe"))
{
tool = new ilTool();
//use directory as version string
int last = str.LastIndexOf(Path.DirectorySeparatorChar);
if (last != -1)
{
tool.Version = str.Substring(last + 1, str.Length - last - 1);
}
else
tool.Version = str;
tool.Path = str + Path.DirectorySeparatorChar + "ilasm.exe";
IlAsm.Add(tool);
}
}
}
}
}
class ilTool
{
public string Path;
public string Version;
}
I've attached a exe with the bug fixed. [now deleted, get the latest version from my website]
I only have the .net 3.5 runtime installed and I can't see a .net 3.5 ilasm. Perhaps 3.5 just uses the 2.0 ilasm/ildasm.
If anybody can provide a method to find ilasm/ildasm for .net 3.5 I will add it in but can't say if dll_tool will actually work with the new tools.
By way of demonstration, he emitted a batlike squeak that was indeed bothersome.