How do I have spaces in a MSBuild WebProjectOutputDir?

你。 提交于 2019-12-03 09:45:16
johnofcross

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\"

should be

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

and magically it works!

CNtw

Try add " ex:

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

Msbuild also seems to work with spaces in the OutDir if you switch \ to /, while using quotes:

/p:OutDir="c:/temp/deploy/fun and games/out/"
/p:WebProjectOutputDir="c:/temp/deploy/fun and games/Deployment/"
Ganesh R.
> "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\fun and games\Deployment\"
----------------------------------------

> /p:Configuration=Release

Try this.

Also try via VSStudio GUI. Then copy the settings & try with MS Build.

For me the working solution is:

/p:SQLCMD="\"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE\""

In other words: Putting all the string into quotes (the external quotes aren't passed as value to MSBuild).

The value inside MSBuild for this property is: "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE" (with the quotes).

Valentin Yanakiev

If you have multiple parameters in a switch you can't really 'avoid' the problem by fixing the path. What you can do is put your parameters of the switch between " some_parameters1 some_parameters2 ".

Something like:

<Exec Command="SomeCommand /useMultipleParameterSwitch=&quot;value1:blabla1 | value2:blabla2&quot;"/>

Of course a lot depends of the syntax of the switches but that works for me and my team.

To do this when using a .proj file and your path is included in properties like $(DeployFolder) and $(NuGetExe), you can use "&quot;" like this:

<Exec Command="&quot;$(NuGetExe)&quot; pack -OutputDirectory &quot;$(DeployFolder)&quot;" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!