我尝试使用类 ProcessInfo 从 C# 启动 ilasm
string arguments = string.Format("\"{0}\" /exe /output:\"{1}\" /debug=IMPL", ilFullFileName, exeFileFullName);
ProcessStartInfo processStartInfo = new ProcessStartInfo(CILCompiler, arguments);
processStartInfo.UseShellExecute = false;
processStartInfo.CreateNoWindow = false;
processStartInfo.WorkingDirectory = @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\";
using (Process process = Process.Start(processStartInfo))
{
process.WaitForExit();
}
论据是:
"path_to_il.il" /exe /output:"path_to_exe.exe" /debug=IMPL
然后它给了我错误:
The application was unable to start correctly (0xc0000007b). Click Ok to close the application.
奇怪的是,当我使用 bat 文件手动执行完全相同的操作时
"c:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe" "path_to_il.il" /exe /output:"path_to_exe.exe" /debug=IMPL
pause
它确实有效。
我错过了什么?