开发者

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

开发者 https://www.devze.com 2023-02-10 01:44 出处:网络
I\'m running msbuild from the command line with the following: msbuild mysolution.sln -p:outputdir=c:\\mydir

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?


You should use OutputPath and more important you should use the right syntax :

msbuild mysolution.sln /p:OutputPath=c:\mydir


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.


I believe you should be using OutputPath.

0

精彩评论

暂无评论...
验证码 换一张
取 消