2

Closed

Package Creation fails due to extra escape character in the formed arguments

description

Getting the below error for simple classlibrary project.
1>------ Build started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
1> ClassLibrary1 -> C:\SVN\New_Training\training01\trunk\VS2013\CSharp\Exercise1\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll
1> Building NuGet package in Post-Build event...
1> Pre-processing the project file to make sure the assembly exists where NuGet.ex
1> e will expect it to be, started at 14:43:26.3436683.
1> The Output Directory is the same as defined in the project file, so no pre-proc
1> essing actions were required.
1> Pre-processing the project file finished running at 14:43:26.4676683. Completed
1> in 0.124 seconds.
1> VERBOSE: New-NuGetPackage script started running at 14:43:26.5066683.
1> VERBOSE: About to run Pack command '&
1> "C:\SVN\New_Training\training01\trunk\VS2013\CSharp\Exercise1\ClassLibrary1\Cla
1> ssLibrary1\PostBuildScripts\NuGet.exe" pack
1> "C:\SVN\New_Training\training01\trunk\VS2013\CSharp\Exercise1\ClassLibrary1\Cla
1> ssLibrary1\ClassLibrary1.csproj" -OutputDirectory
1> "C:\SVN\New_Training\training01\trunk\VS2013\CSharp\Exercise1\ClassLibrary1\Cla
1> ssLibrary1\bin\Debug" -Properties Configuration="Debug"`;Platform="AnyCPU"
1> -NonInteractive '.
1> VERBOSE:
Runnning the Nuget.Exe command gives the below error.
"C:\SVN\New_Training\training01\trunk\VS2013\CSharp\Exercise1\ClassLibrary1\ClassLibrary1\PostBuildScripts\NuGet.exe" pack "C:\SVN\New_Training\training01\trunk\VS2013\CSharp\Exercise1\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" -OutputDirectory "C:\SVN\New_Training\training01\trunk\VS2013\CSharp\Exercise1\ClassLibrary1\ClassLibrary1\bin\Debug" -Properties Configuration="Debug"`;Platform="AnyCPU"
__
Unable to find 'ClassLibrary1.dll'. Make sure the project has been built.__


The reason seems to be escap character in the formed nuget.exe switches... Not sure why that character comes into it? see the line below having extra escap character.

______-Properties Configuration="Debug"`;Platform="AnyCPU"______


Please help
Closed Aug 14 at 12:45 AM by deadlydog
This should be fixed in v1.5.2 of the script and v.1.8.2 of the NuGet package.

comments

deadlydog wrote Jun 14 at 12:58 AM

Thanks for reporting this. I'll look into it.

patrickb01 wrote Jun 20 at 5:01 PM

I have this problem also - I Initially only had it while trying to run this package from a Jenkins CI server through MSBuild, however in trying to fix that I updated to latest -pre build, and subsequently I had the same problem locally. It appears that with the escape character nothing happens, but without the escape character the script fails because the command is split on the semi-colon (Which is the reason the escape character is there in the first place)

I tried converting the platform/configuration settings into a pair of -prop calls in the script, as opposed to a semi-colon separated properties collection, but that had no impact. I have run the pack command through the command line and it seems to work fine, so I'm not sure what the problem is

deadlydog wrote Jul 8 at 5:32 PM

Hmmmm, are you sure that the backtick (i.e. escape character) is the problem? When I create a new vanilla console app and add the NuGet package everything builds fine, and I can see in the output that the backtick is included. I think that the problem may be something else.

Can you please update the to latest prerelease (1.8.1-Prerelease2) and try again. If you still have the problem then please post the FULL text from the output window, not just a snippet of it. Thanks.

deadlydog wrote Jul 16 at 12:53 AM

Are you still having this problem when using the new 1.8.1 version of the NuGet package? If so, can you please post the entire text from the output window. I am still unable to reproduce the problem.

deadlydog wrote Aug 9 at 11:34 PM

There is a new v1.8.2 version of the NuGet package that brings back PowerShell v2.0 compatibility. If you still experience the issue with this version can you please let me know and post the entire text from the output window. Thanks.

jgohel wrote Aug 12 at 6:14 PM

This is cool , Sorry I couldn't reply immediately. I will test it out and let you know.

Thanks.

jgohel wrote Aug 13 at 7:51 AM

What changes have you done to make this compatible with PS 2.0 ?

deadlydog wrote Aug 13 at 4:36 PM

It's in the release notes:
  • Changed the Invoke-Expression statements to not use the -OutVariable parameter, as it is not properly compatible with PowerShell v2.0.
I tested the script out in PowerShell v2.0 and was able to make a package no problem. However, I was not able to test the NuGet package in PowerShell v2.0.

Are you still having the problem? Or is it fixed now in v1.8.2?

jgohel wrote Aug 14 at 12:10 AM

This is working fine. Thanks.