I'm writing a C# program in Visual Studio 2012 and I have a problem. Here's my code fragment:
Process proc = new Process();
proc.StartInfo.Verb = "runas";
proc.StartInfo.FileName = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm.exe";
proc.StartInfo.Arguments = "Absolute\\path\\to\\File.dll /codebase /tlb";
proc.Start();
proc.WaitForExit();
MessageBox.Show("Exit code: "+proc.ExitCode);
proc.Close();
The problem is, when I build a Debug binary and run it, it works just great. Launches regasm.exe, registers the DLL, generates the .tlb file and it's all dandy.
But when I run a Release binary, nothing works and the MessageBox shows me "Exit code: 100". I looked it up but haven't really found anything useful at all.
Found my solution here: http://objectmix.com/dotnet/320921-regasm-tlb-complaints-element-not-found.html
RegAsm.exe error was like this:
RegAsm : error RA0000 : Type library exporter encountered an error while
processing 'Ruby2net.IRuby2net, Ruby2net'. Error: Element not found.
It looks like it was because I accidentally used the same GUID
twice in my program. Thank you all for your time.
Lots of Google hits for "regasm exit code 100", just have a look-see.
Regasm will display an error message, you just can't see it because the console window immediately closes. You need to keep it open so you can read the error message. Do so by running cmd.exe with the /k option (keep). Roughly:
var proc = new System.Diagnostics.Process();
proc.StartInfo.Verb = "runas";
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/k C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm.exe \"Absolute\\path\\to\\File.dll\" /codebase /tlb";
proc.Start();
It turns out to be such a stupid mistake, as always...
The problem was that I used the same GUID in two places, a simple error when copying and pasting. Thank you all for your precious time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With