Nuget packages deployment bug - "'' is not a valid version string" for package dependencies

If nuget package specification file contains dependency with version="" package fails to be deployed with the exception.

‘’ is not a valid version string.
System.ArgumentException: ‘’ is not a valid version string.
at NuGet.Versioning.VersionRange.Parse(String value, Boolean allowFloating)
at NuGet.Packaging.ManifestReader.<>c.b__9_3(<>f__AnonymousType72 <>h__TransparentIdentifier1) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at NuGet.Packaging.ManifestReader.ReadDependencyGroups(XElement dependenciesElement) at NuGet.Packaging.ManifestReader.ReadMetadataValue(ManifestMetadata manifestMetadata, XElement element, HashSet1 allElements)
at NuGet.Packaging.ManifestReader.ReadMetadata(XElement xElement)
at NuGet.Packaging.ManifestReader.ReadManifest(XDocument document)
at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func2 propertyProvider, Boolean validateSchema) at Octopus.Core.Packages.NuGet.LocalNuGetPackage.ReadMetadata(String filePath, Nullable1& createdDate) in Y:\Work\refs\tags\3.4.8\source\Octopus.Core\Packages\NuGet\LocalNuGetPackage.cs:line 97
at Octopus.Core.Packages.NuGet.LocalNuGetPackage…ctor(String filePath) in Y:\Work\refs\tags\3.4.8\source\Octopus.Core\Packages\NuGet\LocalNuGetPackage.cs:line 27
at Octopus.Core.Packages.PackageDownloader.AttemptToFindAndDownloadPackage(Int32 attempt, PackageIdentifier packageIdentifier, IFeed feed, String cacheDirectory, IPackage& downloadedPackage, String& path) in Y:\Work\refs\tags\3.4.8\source\Octopus.Core\Packages\PackageDownloader.cs:line 154
at Octopus.Core.Packages.PackageDownloader.AttemptToDownload(PackageIdentifier packageIdentifier, IFeed feed) in Y:\Work\refs\tags\3.4.8\source\Octopus.Core\Packages\PackageDownloader.cs:line 102
Octopus.Server version 3.4.8 (3.4.8+Branch.master.Sha.3b954a4f3454a6e57742a7a5d5d9e2708a12f454)
If the version="" is omitted than there is no problem.

Prior to version 3.4.8 version="" worked fine. Because of this problem we are unable to deploy some of the historical packages.

Thank you.

Hello Dawid,

​Thank you for getting in touch. In 3.4.0 we added support for SemVer2, which involved upgrading the Nuget libraries we use to parse nuspec files. It looks like it no longer supports blank version numbers.

I will look further into whether we can work around this limitation in the parser. In the meantime, what was the version of OctopusDeploy you were previously using?

Hi we have found something similar to this as well. We had packages with the build number format 0.XXX that we were picking up from a TeamCity nuget feed.

Octopus began failing after the upgrade to 3.4 with: NuGet.Protocol.Core.Types.FatalProtocolException: The V2 feed at ‘http://teamcityfeed/FeedService.svc/Packages(Id=‘packagename’,Version=‘0.768.0’)’ returned an unexpected status code ‘400 Bad Request’.

Octopus seems to be expecting a proper semver build number now as you can see from the error, it is looking for version 0.768.0 not 0.768. We added a .0 onto the teamcity build number and everything works again now.

Not too bad to fix, and we should have been using proper semver versioning anyway, but still a breaking change in 3.4. We upgraded from 3.3.

Hi Dawid and Paul,

We’ve added issues to track these two items:


Robert W