【发布时间】:2012-10-13 08:38:45
【问题描述】:
我正在尝试使用 bat 文件和 C# 编译 IL 代码。这是一段C#代码
ProcessStartInfo processStartInfo = new ProcessStartInfo(ILCompiler, @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\" + ILCompiler +
" "+OutILFile+" /exe /output:" + OutExeFile + " /debug=IMPL");
processStartInfo.UseShellExecute = false;
processStartInfo.CreateNoWindow = false;
using (Process.Start(processStartInfo)) ;
这是一个bat文件
c:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe Source.il /exe /output:my-assebmly.exe /debug=IMPL
pause
运行 ILAsm 的字符串完全相同(即processStartInfo.Arguments = Arguments = "c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\ilasm.exe Source.il /exe /output:my-assebmly.exe /debug=IMPL")
尽管如此,当我使用 C# 运行时出现错误
程序无法启动,因为您的计算机缺少 fusion.dll。尝试重新安装程序以解决此问题。
我该如何解决?我需要使用 C# 运行 ILAsm。
【问题讨论】:
-
不,我是说 ILAsm。我需要将 *.il 文件编译为 *.exe。
-
这仅仅是工作路径没有设置吗?尝试将工作路径设置为 ilasm 所在的文件夹
-
尝试设置
processStartInfo.WorkingDirectory = @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\" -
@Nacereddine,现在看来它正在工作。太棒了。
-
我会将其作为答案发布,以便您关闭此问题。