473,382 Members | 1,369 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,382 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\


Nov 16 '05 #1
2 1188
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\


Nov 16 '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
Nov 16 '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...
1
by: Uday | last post by:
hi everyone, I searched in faq's but couldn't find and solution... so here I post the popular question.. Env: Win2003 server / IIS6.0 Simple ASP page that runs a batch file. When I run the...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.