如何在MSBuild WebProjectOutputDir中保留空格? [英] How do I have spaces in a MSBuild WebProjectOutputDir?

查看:309
本文介绍了如何在MSBuild WebProjectOutputDir中保留空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从命令行调用MSBuild.当我使用没有空格的路径时,一切都工作正常,但是现在我有了包含空格的路径,命令失败了.

I am trying to call MSBuild from a command line. Everything was working fine when I was using a path that had no spaces, but now I have a path that has spaces and the command is failing.

命令(有效):

"C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe" 
/t:Rebuild "C:\Projects\myProject.csproj" 
/p:OutDir=c:\temp\deploy\funAndGames\Deployment\bin\ 
/p:WebProjectOutputDir=c:\temp\deploy\funAndGames\Deployment\ 
/p:Configuration=Release

然后我添加引号并将OutDir更改为OutPath(不起作用):

I then added quotes and changed OutDir to OutPath (doesn't work):

"C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe" 
/t:Rebuild "C:\Projects\myProject.csproj" 
/p:OutPath="c:\temp\deploy\funAndGames\Deployment\bin\" 
/p:WebProjectOutputDir="c:\temp\deploy\funAndGames\Deployment\" 
/p:Configuration=Release

我想要的是这样的东西(不起作用):

What I am aiming for is something like this (doesn't work):

"C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe" 
/t:Rebuild "C:\Projects\myProject.csproj" 
/p:OutPath="c:\temp\deploy\fun and games\Deployment\bin\" 
/p:WebProjectOutputDir="c:\temp\deploy\fun and games\Deployment\" 
/p:Configuration=Release

关于带空格的OutDir/OutPath和WebProjectOutputDir语法的帮助吗?是否有可能?如果不是,那么有人知道原因是什么(由于某些网址没有空格类型的东西?)

Any help on the syntax around OutDir/OutPath and WebProjectOutputDir with spaces? Is it possible? If it isn't does anyone know what the reason is (due to some Url's not having spaces type thing?)

推荐答案

刚刚找到了这个旧问题的答案. 要处理空格,应在所有文件夹上使用转义符\.基本上

Just found this out an answer to this old question. To handle spaces, you should use the escape character \ on all folders. Basically

/p:OutPath="c:\temp\deploy\fun and games\Deployment\bin\"

应该是

/p:OutPath="c:\\temp\\deploy\\fun and games\\Deployment\\bin\\"

神奇地有效!

这篇关于如何在MSBuild WebProjectOutputDir中保留空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆