Calling certain MSBuild commands that receive a project sends a switch with no escaped spaces or special characters, causing MSBuild to fail.
Successful building! :)
0.15.2
64-bit
Windows
Nope, local.
Code excerpt at https://gist.github.com/josemaia/b5ceede38cc3e72e0a61f610b52c9e36
The failure is on l. 44 (see Output log).
When investigating the issue, I detected a series of StackOverflow and similar questions where this happens via the command line, however, I could not manipulate the way Cake sends its parameters to MSBuild. See: http://stackoverflow.com/questions/16979137/msbuild-error-msb1008-only-one-project-can-be-specified-in-teamcity or http://stackoverflow.com/questions/3779701/msbuild-error-msb1008-only-one-project-can-be-specified.
https://gist.github.com/josemaia/d2d27396c313aac0bc9c1d56b68fae24
@josemaia聽Have you tried to聽quote the PackageLocation property? It looks like this at the moment: /p:PackageLocation=E:\um teste\DEV\build-package\Release
As shown in the code sample, I am doing this to add the property to the MSBuild object:
.WithProperty("PackageLocation", new string[]{packagesDir.ToString() })
Is there any way I could ensure this is quoted? I attempted to insert ' and " in several places, but it did not work as desired.
Try .WithProperty("PackageLocation", new string[]{packagesDir.ToString().Quote() })
Looks like the .Quote() method did it!
I was unaware it existed, thank you.
Most helpful comment
Try
.WithProperty("PackageLocation", new string[]{packagesDir.ToString().Quote() })