Alex Rivera | Logout

msbuild -p:outputdir=c:\mydir being ignored

Asked 2011-02-11T04:02:31.783
68

I'm running msbuild from the command line with the following:

msbuild mysolution.sln -p:outputdir=c:\mydir

When I run this, the outputdir is being ignored and the default specified in the csproj file is being used.

The MSDN doc for this tool says that I should be able to override the build directory using this parameter. What am I doing wrong?

Edit
Report

1 Answer

9

Note that OutputPath is preferred over OutDir. The documentation used to be wrong about this, but I see that they've finally fixed it.

Beyond that, it's difficult to say exactly what the problem is, since you didn't show the exact path that you're passing as a parameter. There are two possible problems that I can imagine:

  1. The OutputPath option specifies the path to the output directory relative to the project directory. That means you can't set it to a global path like C:\mydir. I assume it is unable to find the path you specified, and so it defaults to the one specified in your project file.

  2. If the path that you're actually specifying as a parameter contains spaces, the command is likely to fail. I believe you need to wrap the path in quotes and append an extra backslash to the end of the path string.

answered 2011-02-11T04:22:31.840

Your Answer