1

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. :/ )

Program.X
  • 7,250
  • 12
  • 49
  • 83

2 Answers2

1

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.

Program.X
  • 7,250
  • 12
  • 49
  • 83
0

So both this:

NuGet.exe" pack ".\MyPackage.nuspec" -Version 1.0.1-alpha

and

<?xml version="1.0" encoding="utf-8"?>
<package>
  <metadata>
    <id>MyCoolPackage</id>
    <version>1.0.1-alpha</version>
    <authors>MyAuthors</authors>
    <owners>MyOwner</owners>
    <!-- <licenseUrl>http://www.yourLicenseUrl.com</licenseUrl>  -->
    <projectUrl>http://www.yourProjectUrl</projectUrl>
    <iconUrl>http://www.yourIconUrl.com</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>BuildDate : 2013_10_16__17:13:46</description>
    <releaseNotes>My Release Notes.</releaseNotes>
    <copyright>Copyright 2013</copyright>
    <tags>MyTag1 MyTag2</tags>
    <dependencies>
      <!--
            <dependency id="SampleDependency" version="1.0" />
            -->
    </dependencies>
  </metadata>
</package>

worked for me.

I am using 2.7.40809.172.

So try:

( Number 1 )

take out your

<dependencies>

(just for kicks)

( Number 2 )

~try a later version of

NuGet.exe

(although based on the documentation, you should be ok)

I pulled

1.0.1-alpha

straight from the documentation.

Start with that, then work your way up to your custom value.

http://docs.nuget.org/docs/reference/versioning

So I took your nuspec , and put it in my demo code.

and it worked! (I'm xml updating the description, fyi, thus the small discrepancy) (see xml below)

But I got a nice "xxx.Web.Mvc.1.0.3-prelrelease1.nupkg" file created.

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <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>BuildDate : 2013_10_17__11:29:15</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" />
    </dependencies>
  </metadata>
</package>

So maybe it has something to do with the "contents", not the spec.

So you can do a "basic" package, like:

.\Package.nuspec
.\content\
.\content\SomeImageFile.png
.\lib\
.\lib\net20\SomeDll.dll

and see if that works with your nuspec file with the pre-release versioning?

granadaCoder
  • 26,328
  • 10
  • 113
  • 146
  • Thanks :) I've tried both (1) and (2) and am now running on NuGet 2.7. I still get the same error with and without the -Version flag. Also, I was looking at the same documentation. Something is awry ... – Program.X Oct 17 '13 at 09:22
  • Did you try (temporarily) removing your entries? (for kicks) – granadaCoder Oct 17 '13 at 13:23
  • Did you try replacing "prelrelease1" with "alpha", maybe it does not like that trailing "1" at the end of "prelrelease1" ? – granadaCoder Oct 17 '13 at 13:26
  • Yes, I did try removing the dependencies section. Also, tried a different nuspec file without the dependencies section. I also tried variants of the prerelease tag, including alpha, etc. as suggested in the docs - with and without numbers. But no luck ... – Program.X Oct 17 '13 at 15:04
  • I appended my response. – granadaCoder Oct 17 '13 at 15:34
  • Thanks for staying with this one. I updated my question with a very basic XML file structure ... still falls over as soon as I add the prerelease version info. – Program.X Oct 18 '13 at 08:42
  • 1
    I'm out of ideas. One last hail-mary. Go get this tool: http://www.voidtools.com/ (which is good to have for many things). Do a search for "NuGet.exe", and rename or remove all them except the latest-greatest one.........just to make sure.......... This one is weird dude. – granadaCoder Oct 18 '13 at 13:08
  • 1
    And you could try another machine........since you can copy/paste a small directory.....and run the nuget.exe command line. Again, a hail mary that "its your machine"............. – granadaCoder Oct 18 '13 at 13:09
  • I tried another machine, works fine! Frustrating. Just a `nuget pack Package.nuspec`, nothing special. Just tried downloading the command line tool again and running in its own shell, and still no luck. – Program.X Oct 18 '13 at 15:45