Welcome to MSDN Blogs Sign in | Join | Help

How To: Specify Long Command Lines to MSBuild

Sometimes when using MSBuild.exe the command lines can get pretty darn long and hard to manage. This is particularly true if you're using a custom logger that takes parameters. I also ran into some trouble when I was trying to pass an escaped string to the custom logger via the Visual Studio UI for project properties (the string was getting automatically unescaped by VS. Remind you of a recent blog entry?). The answer to both these problems is to use a response file for the command line parameters.

Response files are super easy. Just create a text file using your favourite text editor and put all your command line parameters in it. Then when you run MSBuild use the following command:

msbuild @parameters.txt

Then MSBuild will read all the command line parameters from the text file, and proceed as usual.

[ Author: Neil Enns ]

Published Tuesday, November 29, 2005 4:40 PM by msbuild
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

Tuesday, November 29, 2005 12:36 PM by Uwe Keim

# re: How To: Specify Long Command Lines to MSBuild

Can I put the parameters into multiple lines for better readability in the response file?
Tuesday, November 29, 2005 4:10 PM by TommyW

# re: How To: Specify Long Command Lines to MSBuild

Yes, you can use multiple lines. You can even include comments.

See: http://blogs.msdn.com/csharpfaq/archive/2004/10/20/245238.aspx
Tuesday, November 29, 2005 4:14 PM by TommyW

# re: How To: Specify Long Command Lines to MSBuild

I sent that too soon. If you look in your .NET FX install directory (c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727, for example) you can find a few examples of response files: csc.rsp, MSBuild.rsp, vbc.rsp.
Wednesday, June 07, 2006 12:17 AM by insurance auto

# re: How To: Specify Long Command Lines to MSBuild

Thanks!!! http://www.insurance-top.com/company/">http://www.insurance-top.com/company/ auto site insurance. [URL=http://www.insurance-top.com]home insurance[/URL]: The autos insurance company, compare car insurance, auto insurance. Also [url=http://www.insurance-top.com]cars insurance[/url] from website .
Wednesday, June 07, 2006 12:17 AM by insurance auto

# re: How To: Specify Long Command Lines to MSBuild

Hi! http://www.insurance-top.com/company/ auto site insurance. The autos insurance company, compare car insurance, auto insurance. from website .
Wednesday, June 07, 2006 12:17 AM by cpmcidj@google.com

# re: How To: Specify Long Command Lines to MSBuild

ringtones free
Monday, April 09, 2007 7:32 PM by renuka

# re: How To: Specify Long Command Lines to MSBuild

Executing *.wdproj file through command line MSbuild.exe, its getting the build mode from the IDE even given in the /p:Configuration=Release

# MSBuild Team Blog How To Specify Long Command Lines to MSBuild | Paid Surveys

# MSBuild Team Blog How To Specify Long Command Lines to MSBuild | Weak Bladder

# MSBuild Team Blog How To Specify Long Command Lines to MSBuild | patio umbrella

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker