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.


  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!!!”> auto site insurance. [URL=]home insurance[/URL]: The autos insurance company, compare car insurance, auto insurance. Also [url=]cars insurance[/url] from website .

  5. Hi! 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