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 ]