PC Review


Reply
Thread Tools Rate Thread

Calling devenv.exe from Process

 
 
SR
Guest
Posts: n/a
 
      22nd Jul 2003
Hi
Would suggest that instead of using the process class and
invoking the devenv, u try using the VS.Net object
library. This will help you perform the operations in a
much more controlled way.



regards,

sr

>-----Original Message-----
>Hi,
>
>I'm trying to call devenv.exe (VS.NET 2003) from within a

c# app to
>compile a solution. This works fine when the solution

compiles
>properly, but for some reason I can't seem to get the

output from the
>application back properly when a compilation error occurs.
>
>In the code below the "Error!" prints, but there is no

text
>afterwards, and the application is thrown, but the

standard error
>string is emtpy.
>
>I know the output is definately an error. If I change the

following
>line:
>
>// in the code below its false
>_BuildProcess.StartInfo.UseShellExecute = true;
>
>Then a new command line window appears and the VS.NET

compilation
>error is briefly displayed prior to the window shutting

down.
>Unfortunately I'm unsuccesful in reading the error output

from
>StandardError, which means I can't trap compilation

errors.
>
>Any ideas?
>
>Thanks
>
>- Simon
>
>--------------------
>
>_BuildProcess = new System.Diagnostics.Process();
>_BuildProcess.EnableRaisingEvents = false;
>
>_BuildProcess.StartInfo.UseShellExecute = false;
>_BuildProcess.StartInfo.FileName="devenv";
>_BuildProcess.StartInfo.Arguments = "/rebuild release " +
>solutionFile;
>_BuildProcess.StartInfo.WorkingDirectory = localDirectory;
>_BuildProcess.StartInfo.RedirectStandardError = true;
>_BuildProcess.StartInfo.RedirectStandardOutput = true;
>
>_BuildProcess.Start();
>_BuildProcess.WaitForExit();
>
>Console.WriteLine("Error! " +
>_BuildProcess.StandardError.ReadToEnd());
>_BuildProcess.StandardError.Close();
>
>// Exit code other than zero is an error
>if (0 != _BuildProcess.ExitCode)
> throw new ApplicationException(
> string.Format(
> "Build error - Exit Code: {0}; Error: {1}; Output:

{2};",
> _BuildProcess.ExitCode, _BuildError, _BuildOutput));
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling FTP process =?Utf-8?B?SmltIEhlYXZleQ==?= Microsoft C# .NET 1 31st Mar 2006 08:31 PM
.NET IDE Crashes when trying to attach aspnet_wp.exe process and debug with faulting appication devenv.exe error shashikant.mundlik@gmail.com Microsoft ASP .NET 0 3rd Feb 2006 06:26 AM
Calling the IPConfig process Manoj Nair Microsoft C# .NET 2 6th Apr 2005 04:31 AM
How to know calling process name? David Hoffer Microsoft Dot NET Framework 1 9th Sep 2004 09:00 PM
Calling a method on a different process Mike Smith Microsoft C# .NET 3 8th Aug 2003 07:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:14 PM.