Reputation: 2453
I'm packing an application using Cruise Control, the command is like this
<Exec Command="$(NugetToolPath) pack "@(NuSpecs)" -OutputDirectory \\servername\PackageSource -BasePath "%(NuSpecs.RootDir)%(NuSpecs.Directory)" -NoPackageAnalysis" />
Iv'e narrowed down the error to be the BasePath it comes out as
-BasePath "D:\Code\Mobile_Trunk\PreCompiledWeb\Portal\Mobile LT Admin\"
I know the issue because it should be
-BasePath "D:\Code\Mobile_Trunk\PreCompiledWeb\Portal\Mobile LT Admin"
but because I'm using .Directory metadata it will always return with a \ at the end
I normally wouldn't quote the base path, but since there are spaces in the directory, I have no choice. Is there a way around this? I don't know any other metadata which will return the full folder strucutre other than how I've layed it out
UPDATE:
I came to this solution, it's still not helped my knowledge on how to get around the issue with the illegal path, but it works.
<Exec Command="$(NugetToolPath) pack "%(NuSpecs.RootDir)%(NuSpecs.Directory)%(Nuspecs.FileName).nuspec" -OutputDirectory \\servername\PackageSource -NoPackageAnalysis" />
Upvotes: 16
Views: 9078
Reputation: 1340
I faced this problem and the error message wasn't too helpful - it did not print out the offending line or path. I had to take out pieces of the config where I suspected the issue might be until I could get to the offending line (removing the offending line allowed the build to pass).
Turns out the offending line had a variable that was blank (I used the Message
task to print it out). From there, I was able set the variable to what my project expected.
Upvotes: 0
Reputation: 79725
We got this error when we executed nuget restore
from Jenkins, where we ran a JNLP agent on the slave-node.
Turns out that "Path" in Illegal characters in path
means the PATH environment variable, and in our case nuget.exe was inheriting a PATH variable that had quotes in it, i.e. something like:
Path=C:\Program Files\foo;"C:\Program Files\bar"
If you are using Jenkins, add echo %PATH%
to be executed somewhere by Jenkins, and check if it has any funny characters.
Upvotes: 2
Reputation: 19118
Just insert a space after the directory and before the quote character:
-OutputDirectory "\\servername\PackageSource\ "
See the accepted answer here (the question itself isn't highly relevant but the answer is):
How to accept command-line args ending in backslash
This fascinating reference is also linked to in another answer on that question:
http://www.daviddeley.com/autohotkey/parameters/parameters.htm#WINCRULESDOC
Upvotes: 18