473,466 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Calling devenv.exe from Process

SR
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 tocompile a solution. This works fine when the solution compilesproperly, but for some reason I can't seem to get the output from theapplication back properly when a compilation error occurs.

In the code below the "Error!" prints, but there is no textafterwards, and the application is thrown, but the standard errorstring is emtpy.

I know the output is definately an error. If I change the followingline:

// in the code below its false
_BuildProcess.StartInfo.UseShellExecute = true;

Then a new command line window appears and the VS.NET compilationerror is briefly displayed prior to the window shutting down.Unfortunately I'm unsuccesful in reading the error output fromStandardError, 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));
.

Jul 19 '05 #1
0 2846

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Craig Leigh | last post by:
I have created a website to perform simple builds for our development staff. When I call devenv.exe from a batch file, a cgi script or a compiled 'C++' program the program times out, won't run or...
3
by: Selden McCabe | last post by:
Has anybody experienced this problem? I have a solution that consists of 6 or 7 projects. Every so often (2 or 3 times a week) when I click Run, everything builds seemingly OK, but then, just when...
0
by: micc | last post by:
I am using devenv to build a solution. The Solution comprises 2 projects :- one C++ and the other a Fortran project. I created this solution by automatically converting a Visual Studio version...
0
by: dsmith | last post by:
I installed VS .Net 2003 60 day trial version in Windows XP Pro environment. When I tried to launch VB .Net I got the following error: "Visual Studio ..Net is unable to start because the file...
0
by: Marcos Lima | last post by:
Hi, Does anybody reach this situation: When selecting "Add Resrouce", on a .rc file, the IDE disappear suddenly. I debuged the devenv.exe with another instance of it, and the output window...
0
by: SR | last post by:
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....
2
by: roel.schreurs | last post by:
Sometimes, I want to archive or transport a solution. In such cases, I would like to remove all redundant files from the solution, i.e. all compiler output. The documention describes the command...
0
by: shashikant.mundlik | last post by:
Hi All, My .NET IDE is crashing when trying to attach any process in ASP.net application and try to debug. The error message is as follows. Faulting application devenv.exe, version 7.10.3077.0,...
1
by: wandii | last post by:
Hi, I've been working with devenv from the command line for the last couple of days and cannot get to build the msi file correctly. if I excecute the devenv.exe via the command line or batch...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.