473,378 Members | 1,457 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,378 software developers and data experts.

Launching command line compiler

Hello,

I am trying to automatically compile all my projects but I am stuck on
something silly: launching csc with the right arguments.

Here is my code

private void CompileProject(string RSPFile)
{
System.Text.StringBuilder sbArgs = new
System.Text.StringBuilder(100);
System.Diagnostics.Process procManager = new
System.Diagnostics.Process();

procManager.StartInfo.FileName = @"csc";

sbArgs.Append(@"@" + RSPFile);
procManager.StartInfo.Arguments = sbArgs.ToString();

procManager.Start();
}

Which I call using
CompileProject(@"C:\Dev\C#\Libraries\SD_StdClasses \SD_StdClasses.rsp");

If I compile myself using hard command line (cmd) it works fine.

Can you help please?

Thanks

--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/

Dec 22 '05 #1
3 1640
sbArgs.Append(@"@" + RSPFile);
" " ( space ) is parameter separator.

Take a look at System.CodeDom.Compiler

Also, please, tell us what is the error returned?
Maybe you have to specify full path to csc?

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Michael Moreno" <mi*********************@free.fr> wrote in message
news:mn***********************@free.fr...
Hello,

I am trying to automatically compile all my projects but I am stuck on
something silly: launching csc with the right arguments.

Here is my code

private void CompileProject(string RSPFile)
{
System.Text.StringBuilder sbArgs = new
System.Text.StringBuilder(100);
System.Diagnostics.Process procManager = new
System.Diagnostics.Process();

procManager.StartInfo.FileName = @"csc";

sbArgs.Append(@"@" + RSPFile);
procManager.StartInfo.Arguments = sbArgs.ToString();

procManager.Start();
}

Which I call using
CompileProject(@"C:\Dev\C#\Libraries\SD_StdClasses \SD_StdClasses.rsp");

If I compile myself using hard command line (cmd) it works fine.

Can you help please?

Thanks

--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/

Dec 22 '05 #2
Thanks the file name had no space.
I have tried adding double quote and all sorts of things but it still
fails.

I have given up and I am currently writing a .bat file that does the
job but it is very painful.

For some reasons most of the time the .rsp file does not compile but
copying and pasting its content into a cmd windows works. It is mad!

I have to type in the .bat file things such as

csc /r:"C:\Dev\Compiled\SWS\Dlls\dotNet\ADODB.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\Interop.SD_MSMQ _VB.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\Interop.SD_Serv erIntf.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\MSMQ.dll"
/r:"C:\dev\compiled\sws\dlls\dotnet\SDNet_Serializa bleObjects.dll"
/r:"C:\dev\compiled\sws\dlls\dotnet\SDNet_Serializa bleObjects.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\SDNet_StdClasse s.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\SDNet_SWSRemoti ngAsm.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\SWSConfig.dll " /t:exe
/out:"C:\Dev\Compiled\SWS\SWS Event Server.exe"
/recurse:"C:\Dev\C#\Server Apps\SWS Event Server\*.cs"
which is close to my worst nightmares.

I cannot work out how to use the /lib: tag either.
So running this command
csc /lib:"C:\Dev\Compiled\SWS\Dlls\DevExpress\"
/lib:"C:\Dev\Compiled\SWS\Dlls\Infragistics\"
/lib:"C:\Dev\Compiled\SWS\Dlls\dotNet" /r:"ADODB.dll"
/r:"DevExpress.Data3.dll" /r:"DevExpress.Utils3.dll"
/r:"DevExpress.ExtraEditor3.dll" /r:"DevExpress.xtragrid3.dll"
/r:"Infragistics.Excel.v3.2.dll" /r:"Infragistics.Shared.v3.2.dll"
/r:"Infragistics.Win.UltraWinGrid.ExcelExport.v3.2. dll"
/r:"Infragistics.Win.UltraWinGrid.v3.2.dll"
/r:"Infragistics.Win.v3.2.dll" /r:"Microsoft.VisualBasic.dll"
/r:"MSDATASRC.dll" /r:"SDNet_StdClasses.dll" /r:"StdFormat.dll"
/r:"stdole.dll" /r:"SWSConfig.dll" /t:exe /out:"C:\Dev\Compiled\SWS\SWS
Event Viewer.exe" /recurse:"C:\Dev\C#\Client Apps\SWS Event
Viewer\*.cs"

tells me that dlls cannot be found when it should... aaargh!!!

thanks

--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/

Dec 22 '05 #3
Why can't you use System.CodeDom.Compiler?

Additionally you can have a look at NAnt project.

Also if you have Visual Studio installed type devenv.exe /? you will see the
info how to compile and build vs projects without IDE.

Also if you still want to do that manually
you can refer to

http://msdn.microsoft.com/library/de...rpcompiler.asp

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Michael Moreno" <mi*********************@free.fr> wrote in message
news:mn***********************@free.fr...
Thanks the file name had no space.
I have tried adding double quote and all sorts of things but it still
fails.

I have given up and I am currently writing a .bat file that does the job
but it is very painful.

For some reasons most of the time the .rsp file does not compile but
copying and pasting its content into a cmd windows works. It is mad!

I have to type in the .bat file things such as

csc /r:"C:\Dev\Compiled\SWS\Dlls\dotNet\ADODB.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\Interop.SD_MSMQ _VB.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\Interop.SD_Serv erIntf.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\MSMQ.dll"
/r:"C:\dev\compiled\sws\dlls\dotnet\SDNet_Serializa bleObjects.dll"
/r:"C:\dev\compiled\sws\dlls\dotnet\SDNet_Serializa bleObjects.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\SDNet_StdClasse s.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\SDNet_SWSRemoti ngAsm.dll"
/r:"C:\Dev\Compiled\SWS\Dlls\dotNet\SWSConfig.dll " /t:exe
/out:"C:\Dev\Compiled\SWS\SWS Event Server.exe" /recurse:"C:\Dev\C#\Server
Apps\SWS Event Server\*.cs"
which is close to my worst nightmares.

I cannot work out how to use the /lib: tag either.
So running this command
csc /lib:"C:\Dev\Compiled\SWS\Dlls\DevExpress\"
/lib:"C:\Dev\Compiled\SWS\Dlls\Infragistics\"
/lib:"C:\Dev\Compiled\SWS\Dlls\dotNet" /r:"ADODB.dll"
/r:"DevExpress.Data3.dll" /r:"DevExpress.Utils3.dll"
/r:"DevExpress.ExtraEditor3.dll" /r:"DevExpress.xtragrid3.dll"
/r:"Infragistics.Excel.v3.2.dll" /r:"Infragistics.Shared.v3.2.dll"
/r:"Infragistics.Win.UltraWinGrid.ExcelExport.v3.2. dll"
/r:"Infragistics.Win.UltraWinGrid.v3.2.dll" /r:"Infragistics.Win.v3.2.dll"
/r:"Microsoft.VisualBasic.dll" /r:"MSDATASRC.dll"
/r:"SDNet_StdClasses.dll" /r:"StdFormat.dll" /r:"stdole.dll"
/r:"SWSConfig.dll" /t:exe /out:"C:\Dev\Compiled\SWS\SWS Event Viewer.exe"
/recurse:"C:\Dev\C#\Client Apps\SWS Event Viewer\*.cs"

tells me that dlls cannot be found when it should... aaargh!!!

thanks

--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/

Dec 22 '05 #4

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

Similar topics

2
by: Bob | last post by:
Hi, I'm trying to build a PHP page which launches another php script to be run in the background. The web page should return immediately, while the background script may run for 10 minutes or...
0
by: Hegemony Cricket | last post by:
I've found several good examples out there on how to launch a web browser from a Java application, using the Runtime exec() command. However, what I'd like to do is configure the browser that's...
5
by: Chris | last post by:
Is it possible to use Python to launch JCL jobs on an IBM MVS HOST (OS390) ?
0
by: timandsuzi36 | last post by:
I have a WinForms App that is launching an Access 2003 db Reports program. I am using the System.Diagnostics.Process object to do so. I thought that I could pass my db connection string to Access...
0
by: Scott Zabolotzky | last post by:
I'm using the following code to launch SIGNCODE.EXE to sign a CAB provisioning file from an ASP.NET app. When I run the code the exit code comes back as -1. I have not been able to determine what...
24
by: Alan M Dunsmuir | last post by:
What is the command (in Windows Forms VB.NET) which will cause the subject computer's default browser to launch, and display a specified Web page? -- Alan M Dunsmuir
8
by: Keith French | last post by:
I am trying to launch an external program within Visual Basic 2005 Express. If it is a simple program it works well with:- myProg = "C:\MyFolder\MyApp.exe"...
4
by: vol30w60 | last post by:
Hi folks, I am trying to launch a program with PHP code. I am running Apache on Windows XP SP2. I am using the method noted here: http://us2.php.net/manual/en/function.exec.php#59428 To...
8
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
I would like to find out how I can launch an independent Python program from existing one in a cross-platform way. The result I am after is that a new terminal window should open (for io...
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: 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
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: 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.