Question

I'm trying to compile IL code using bat file and C#. Here is a C# code

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)) ;

Here is a bat file

c:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe Source.il /exe /output:my-assebmly.exe /debug=IMPL
pause

The strings for running ILAsm are exactly the same (that is, processStartInfo.Arguments = Arguments = "c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\ilasm.exe Source.il /exe /output:my-assebmly.exe /debug=IMPL")

In spite of it, I get an error when I run using C#

The program can't start because fusion.dll is missing from your computer. Try reinstalling the program to fix this problem.

How do I fix it ? I need to run ILAsm using C#.

Was it helpful?

Solution

try this :

processStartInfo.WorkingDirectory = @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top