Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Accessing compiler error messages from web page that runs batch file

Reply
Thread Tools

Accessing compiler error messages from web page that runs batch file

 
 
Jon Maz
Guest
Posts: n/a
 
      12-14-2004
Hi All,

To allow myself to make development changes directly on a remote server
*without* having to compile on my local dev machine and then upload the
dll's to remote, I have created a RunBatch.aspx on the remote which calls a
batch file (myBuild.bat) on the same machine, and this batch file executes
the necessary command-line compiler instructions to recompile (code below).

So far (fingers crossed) it seems to be working. The only thing I'm
missing, but would really like access to, is any compiler error messages
that may arise. Does anyone have any ideas how RunBatch.aspx could get hold
of those error messages from csc.exe (or from cmd.exe, I'm not actually
entirely sure where they are), and print those out to the screen?

Thanks!

JON

PS No Visual Studio in this setup, before anyone asks!

**************
RunBatch.aspx
**************

Process myProcess = new Process();
myProcess.EnableRaisingEvents = true;
myProcess.StartInfo.FileName = @"c:\Inetpub\wwwroot\myBuild.bat";
myProcess.StartInfo.WorkingDirectory = "C:/";
myProcess.StartInfo.Arguments = "file.txt -s -m";
myProcess.Start();
myProcess.WaitForExit();
Response.Write("myProcess.ExitCode: " + myProcess.ExitCode + "<br>");


************
myBuild.bat
************

REM Compile data layer
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.e xe /t:library
/out:C:\Inetpub\wwwroot\myProject\myProject_data\ob j\myProject_data.dll
C:\Inetpub\wwwroot\myProject\myProject_data\*.cs /r:System.web.dll
/r:System.dll /r:System.Data.dll /r:System.Web.dll /r:System.XML.dll

REM Compile business layer
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.e xe /t:library
/out:C:\Inetpub\wwwroot\myProject\myProject_busines s\obj\myProject_business.
dll C:\Inetpub\wwwroot\myProject\myProject_business\*. cs
/r:System.web.dll /r:System.dll /r:System.Data.dll /r:System.Web.dll
/r:System.XML.dll /r:System.XML.dll /r:myProject_data.dll
/lib:C:\Inetpub\wwwroot\myProject\myProject_data\ob j\

REM Copy business & data dll's to pres layer bin folder
COPY C:\Inetpub\wwwroot\myProject\myProject_data\obj\my Project_data.dll
C:\Inetpub\wwwroot\myProject\myProject\bin\ /Y
COPY
C:\Inetpub\wwwroot\myProject\myProject_business\ob j\myProject_business.dll
C:\Inetpub\wwwroot\myProject\myProject\bin\ /Y

REM Compile presentation layer
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.e xe /t:library
/out:C:\Inetpub\wwwroot\myProject\myProject\bin\myP roject.dll
/recurse:C:\Inetpub\wwwroot\myProject\myProject\*.c s
/r:System.web.dll /r:System.dll /r:System.Data.dll /r:System.Web.dll
/r:System.XML.dll /r:System.XML.dll /r:myProject_data.dll
/r:myProject_business.dll
/lib:C:\Inetpub\wwwroot\myProject\myProject_data\ob j\,C:\Inetpub\wwwroot\myP
roject\myProject_business\obj\






 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      12-14-2004
Jon,

You can use the Compiler class in the Microsoft.CSharp namespace. You
can set a reference to cscompmgd.dll, and then access it programatically.

It should be noted that this will be marked as Obsolete in .NET 2.0.
I'm not sure what replaces it (although I am sure there will be something).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
-


"Jon Maz" <> wrote in message
news:...
> Hi All,
>
> To allow myself to make development changes directly on a remote server
> *without* having to compile on my local dev machine and then upload the
> dll's to remote, I have created a RunBatch.aspx on the remote which calls
> a
> batch file (myBuild.bat) on the same machine, and this batch file executes
> the necessary command-line compiler instructions to recompile (code
> below).
>
> So far (fingers crossed) it seems to be working. The only thing I'm
> missing, but would really like access to, is any compiler error messages
> that may arise. Does anyone have any ideas how RunBatch.aspx could get
> hold
> of those error messages from csc.exe (or from cmd.exe, I'm not actually
> entirely sure where they are), and print those out to the screen?
>
> Thanks!
>
> JON
>
> PS No Visual Studio in this setup, before anyone asks!
>
> **************
> RunBatch.aspx
> **************
>
> Process myProcess = new Process();
> myProcess.EnableRaisingEvents = true;
> myProcess.StartInfo.FileName = @"c:\Inetpub\wwwroot\myBuild.bat";
> myProcess.StartInfo.WorkingDirectory = "C:/";
> myProcess.StartInfo.Arguments = "file.txt -s -m";
> myProcess.Start();
> myProcess.WaitForExit();
> Response.Write("myProcess.ExitCode: " + myProcess.ExitCode + "<br>");
>
>
> ************
> myBuild.bat
> ************
>
> REM Compile data layer
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.e xe /t:library
> /out:C:\Inetpub\wwwroot\myProject\myProject_data\ob j\myProject_data.dll
> C:\Inetpub\wwwroot\myProject\myProject_data\*.cs /r:System.web.dll
> /r:System.dll /r:System.Data.dll /r:System.Web.dll /r:System.XML.dll
>
> REM Compile business layer
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.e xe /t:library
> /out:C:\Inetpub\wwwroot\myProject\myProject_busines s\obj\myProject_business.
> dll C:\Inetpub\wwwroot\myProject\myProject_business\*. cs
> /r:System.web.dll /r:System.dll /r:System.Data.dll /r:System.Web.dll
> /r:System.XML.dll /r:System.XML.dll /r:myProject_data.dll
> /lib:C:\Inetpub\wwwroot\myProject\myProject_data\ob j\
>
> REM Copy business & data dll's to pres layer bin folder
> COPY C:\Inetpub\wwwroot\myProject\myProject_data\obj\my Project_data.dll
> C:\Inetpub\wwwroot\myProject\myProject\bin\ /Y
> COPY
> C:\Inetpub\wwwroot\myProject\myProject_business\ob j\myProject_business.dll
> C:\Inetpub\wwwroot\myProject\myProject\bin\ /Y
>
> REM Compile presentation layer
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.e xe /t:library
> /out:C:\Inetpub\wwwroot\myProject\myProject\bin\myP roject.dll
> /recurse:C:\Inetpub\wwwroot\myProject\myProject\*.c s
> /r:System.web.dll /r:System.dll /r:System.Data.dll /r:System.Web.dll
> /r:System.XML.dll /r:System.XML.dll /r:myProject_data.dll
> /r:myProject_business.dll
> /lib:C:\Inetpub\wwwroot\myProject\myProject_data\ob j\,C:\Inetpub\wwwroot\myP
> roject\myProject_business\obj\
>
>
>
>
>
>



 
Reply With Quote
 
 
 
 
Jon Maz
Guest
Posts: n/a
 
      12-14-2004
Hi Nicholas,

Thanks for the tip, that's something new for me, I'll look into that
tomorrow from work.

If anyone has any relevant code samples or url's, it'll be much appreciated!

Cheers,

JON







---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Pretty printing compiler error messages for the web Daniel C++ 3 05-15-2009 09:10 AM
Seeking free C++ compiler that runs from USB stick Baron Samedi C++ 2 03-26-2007 09:15 AM
Compiler Error Message: The compiler failed with error code -1073741819 Ram ASP .Net 0 09-13-2005 09:52 AM
accessing the web user control's control from a web page and set a value from another web page Reny J Joseph Thuthikattu ASP .Net 1 12-30-2004 12:21 PM
Compiler Error Message: The compiler failed with error code 128. Yan ASP .Net 0 07-21-2003 10:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57