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 ]

Comments (10)

  1. Uwe Keim says:

    Can I put the parameters into multiple lines for better readability in the response file?

  2. TommyW says:

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

    See: http://blogs.msdn.com/csharpfaq/archive/2004/10/20/245238.aspx

  3. TommyW says:

    I sent that too soon. If you look in your .NET FX install directory (c:WINDOWSMicrosoft.NETFrameworkv2.0.50727, for example) you can find a few examples of response files: csc.rsp, MSBuild.rsp, vbc.rsp.

  4. 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 .

  5. Hi! http://www.insurance-top.com/company/ auto site insurance. The autos insurance company, compare car insurance, auto insurance. from website .

  6. renuka says:

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