473,326 Members | 2,136 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,326 software developers and data experts.

Accessing compiler error messages from web page that runs batch file

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\


Jul 21 '05 #1
2 1890
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]
- mv*@spam.guard.caspershouse.com
"Jon Maz" <jo****@surfeuNOSPAM.de> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
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\


Jul 21 '05 #2
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
Jul 21 '05 #3

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

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
2
by: Jon Maz | last post by:
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...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
1
by: Ramanfromoz | last post by:
Hi, Developing a new we application. Everything okay on my local WIN XP PROFESSIONAL, IIS 5.0 running locally. The website is running smoothly. Now, the same code I am copying over to a...
3
by: Joseph Farmer | last post by:
I want to invoke the ASP.NET compiler in a batch job (part of a debugging build process). I want to build the ASP.NET assembly from my aspx files. I'm not talking about the "code" assembly which is...
0
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or...
8
by: Ben Fidge | last post by:
Hi I have a small WinForms app that needs to copy files from a shared drive on a network. If I connect to the mapped drive using Explorer, a password dialog pops-up and I have to provide...
0
by: beluvic | last post by:
Hi all, can anyone help? I get the error messages below when i try to run end and start of day. the Application is T24 and it runs on SUN Server with Solaris 10 OS,my question is What is causing...
2
by: kkshansid | last post by:
this is my search page on which i am getting two parameters from previous page but the problem is that as soon as i click any other next pages my sql query fails as it doesnt get these two parameters...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.