Search code examples
nugetnuget-packagenuget-spec

Prerelease versioning in NuGet


I am trying to create a NuGet pre-release package. Here is my NuSpec file:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>xxx.Web.Mvc</id>
    <version>1.0.3-prelrelease1</version>
    <authors>xxx</authors>
    <owners>xxx</owners>
    <projectUrl>https://xxx</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>xxxx.</description>
    <releaseNotes>NuGet package.</releaseNotes>
    <copyright>Copyright 2013 xxx</copyright>
    <tags>asmx xxx</tags>
    <dependencies>
  <dependency id="Microsoft.AspNet.Mvc" version="4.0.30506.0" />
  <dependency id="Microsoft.AspNet.Razor" version="2.0.30506.0" />
  <dependency id="Microsoft.AspNet.WebPages" version="2.0.30506.0"  />
  <dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
  <dependency id="xxx" version="1.0.6"  />

    </dependencies>
 </metadata>
</package>

Note I am using the SemVer mechanism for the pre-release version.

However, when I build my package using:

PM> nuget pack Package.nuspec

I get:

nuget : Input string was not in a correct format.
At line:1 char:1
+ nuget pack Package.nuspec
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Input string wa...correct format.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

This directly refers to my having alphabetic characters in the version string.

I am using NuGet 2.2/VS2012.

How come my version string isn't being recognised?

Update

I've reduced the file to:

<?xml version="1.0"?> <package >   <metadata>
    <id>xxx</id>
    <version>1.0.3-test1</version>
    <authors>xxx</authors>
    <owners>xxx</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>xxx</description>   </metadata> </package>

and a single file in the ~\content folder:

  • ~\content\New Journal Document.jnt

(First time I've seen Windows Journal. Thought I'd try it to make a simple file. :/ )


Solution

  • Fixed it.

    Despite reinstalling NuGet 2.x, it seems I still have a v1.5 hanging around.

    Seems the Powershell environment was using this version and the Package Manager Console Host Version 2.7.40911.225 message didn't refer to the version of PowerShell, just the host. Seems obvious now I know.

    I've manhandled the file and overwritten it.

    All now working.