This project has moved and is read-only. For the latest updates, please go here.

Problem with the version parameter


I´m using the following batch code to build and push a nuget package from jenkins to my private feed (Source and API Key are in the nuget.config defined):
@echo off
git log -1 --pretty=%%B > tmp.txt
set /p VAR=<tmp.txt
echo "%VAR%"

powershell New-NuGetPackage.ps1 -ProjectFilePath 'C:\Program Files (x86)\Jenkins\jobs\CommonExtensions\workspace\CommonExtensions\CommonExtensions\CommonExtensions.csproj' -NoPrompt -Verbose -PushPackageToNuGetGallery -ReleaseNotes "%VAR%"
With the parameter -ReleaseNotes "%VAR%" I get the following output:
C:\Nuget\New-NuGetPackage.ps1 : Das Argument für den Parameter "VersionNumber"
kann nicht überprüft werden. Das Argument "AssemblyInfo" entspricht nicht dem
Muster "(?i)(^(\d{1,5}(\.\d{1,5}){1,3})$)|(^(\d{1,5}\.\d{1,5}\.\d{1,5}-[a-zA-Z0
-9\-\.\+]+)$)|(^(\$version\$)$)|(^$)". Geben Sie ein Argument an, das "(?i)(^(\
(\$version\$)$)|(^$)" entspricht, und führen Sie den Befehl erneut aus.
In Zeile:1 Zeichen:230
+ ... eNotes Changed AssemblyInfo
+                    ~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [New-NuGetPackage.ps1], Paramet
    + FullyQualifiedErrorId : ParameterArgumentValidationError,New-NuGetPackag


deadlydog wrote Feb 7, 2015 at 4:57 PM

Do you only get that error when passing in the -ReleaseNotes parameter? The actual error message is saying that the version number format is not correct; it has to be of the form A.B, A.B.C, A.B.C.D, or A.B.C-Something (where A, B, C, and D are digits of length 1 - 5), or the string "$version$". Since you are passing in the project file path, I'm thinking that either your project's version number (in the AssemblyInfo.cs file) is not in the correct format, or you have a .nuspec file in the same directory as your .csproj file, and that file specifies an invalid version number.

itfactory wrote Feb 7, 2015 at 5:14 PM

Yes, without passing the -ReleaseNotes parameter all is working fine and I´m not having any .nuspec file.
My versions are the default VS AssemblyInfo.cs versions in the following format: "1.1.5515.1821"
I also got the same issue when I tried to pass -PushOptions "-Source ""myserver.domain"" -ApiKey ""mykey""".
To avoid this I defined the PushOptions in the nuget.config file.

deadlydog wrote Jan 23 at 3:21 AM

I wonder if this issue was actually due to your operating system being non-english.

The new New-NuGetPackage.ps1 v1.5.8 now includes a required -ForceEnglishOutput parameter to NuGet.exe. NOTE: The -ForceEnglishOutput parameter is only supported by NuGet.exe v3.5.0+, so be sure you are using at least that version of the NuGet.exe.

If you could try the new version of the script and NuGet.exe and let me know that it does indeed work as expected, or if this problem still persists, I would appreciate that. Thanks.

deadlydog wrote Apr 13 at 6:58 AM

I have also modified the version number regex a bit in v1.5.9 of the script to be a little less restrictive. Can you give it a go and let me know if it's still a problem? Thanks.