Leverage C# Response Files at the Command Line

Published 20 October 04 11:02 AM

Although I'd bet most of you make use of VS .NET as opposed to the raw command line complier, csc.exe can be quite useful in a number of circumstances. However, few of us enjoy typing lengthy command line flags such as:

csc /r: MyAsm.dll;MyOtherAsm.dll /t: winexe /out: myApp.exe *.cs

To lessen your burden, the C# command line compiler supports the use of 'response files'. Simply put, response files are text files which contain all of the command line arguments you wish to feed into the compiler. By convention, these files end with a *.rsp file extension. Thus, assume you have a file named mySettings.rsp:

# Response files support comments.
/r: MyAsm.dll
/r: MyOtherAsm.dll
/t: winexe
/out: myApp.exe *.cs

With this, you can simply specify the name of the response file to use for the current compilation (via the @ symbol):

csc @mySettings.rsp


Tip from Andrew Troelsen
Posted by: Duncan Mackenzie, MSDN
This post applies to Visual C# .NET 2002/2003

Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# FAQ C# said on May 2, 2005 9:46 AM:
# FAQ C# (par Yannick Lejeune) said on August 23, 2005 5:23 AM:
# C Frequently Asked Questions Leverage C Response Files at the | Toe Nail Fungus said on June 9, 2009 1:49 AM:

PingBack from http://toenailfungusite.info/story.php?id=1301

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

This Blog

Syndication

Page view tracker