I'm trying to execute lib.exe (a VC7 tool) from a C# Add-in in VS2K3. This program (lib.exe) runs fine from the VS2K3 command prompt but not from a regular command prompt and not from my C# program. I think the key may be that the vsvars32.bat script needs to run first to setup some environment variables and that is why it works in the VS2K3 command prompt. If I don't specify the working directory I get an exception stating it can't find the file. If I do specify the path I get an exception saying a needed dll is not loaded. Here is an example of the code that doesn't work:
System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = "lib";
p.Start(); // --> Causes an exception
Any ideas how to get a process to run in an environment similar to that of the VS command prompt
.NET Development34
|