473,387 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2832

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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.