How can we improve Azure DevOps?

Support Semver 2.0 packages in VSTS Package Management

Nuget >4.3.0 now supports Semver 2.0 versioning for packages. VSTS package management should also. Semver 2.0 support makes life A LOT easier and ensures that we can make builds and packages with matching versions.

92 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Chris Johnson shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    8 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Paul Hatcher commented  ·   ·  Flag as inappropriate

        Found a slightly cleaner workaround as I couldn't determine which package was causing the problem...

        Add a nuget.config to the project root and configure the nuget restore step to use it e.g.

        <?xml version="1.0" encoding="UTF-8"?>
        <configuration>
        <!-- Default Package Sources; works like the 'packageSources' section of NuGet.Config files. -->
        <!-- This collection cannot be deleted or modified but can be disabled/enabled by users. -->
        <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json&quot; />
        <add key="MyFeed" value="https://MyOrg.pkgs.visualstudio.com/_packaging/MyFeed/nuget/v3/index.json&quot; />
        </packageSources>
        </configuration>
        You should also remove nuget.org as an upstream feed until this is fixed

        If you have nuget.org first, any semver packages are picked up from it and your internal packages are picked from your own feed. Won't work if you've hacked a public packages but otherwise seems to be fine.

      • Rick R. commented  ·   ·  Flag as inappropriate

        We have hit this sporadically since upgrading to ASP.NET Core 2.1. Looks like one of the .NET Core dependencies is dependent on nuget frameworks 4.7.0. This causes our build to randomly fail on VSTS. End of September can't come fast enough... Is there a workaround or do we have to rollback to 2.0?

        From <projectname>.deps.json:

        "Microsoft.VisualStudio.Web.CodeGeneration.Utils/2.1.1": {
        "dependencies": {
        "Microsoft.CodeAnalysis.CSharp.Workspaces": "2.8.0",
        "Microsoft.VisualStudio.Web.CodeGeneration.Contracts": "2.1.1",
        "Newtonsoft.Json": "11.0.2",
        "NuGet.Frameworks": "4.7.0"
        },

      • Diego commented  ·   ·  Flag as inappropriate

        Any news/workaround about this? I am getting the following error and I suspect it's related.

        ```
        The nuget command failed with exit code(1) and error(Failed to download package 'NuGet.Frameworks.4.7.0' from 'https://tuires.pkgs.visualstudio.com/_packaging/efa40ebc-9b3a-4191-b56f-2d75c64afd9a/nuget/v3/flat2/nuget.frameworks/4.7.0/nuget.frameworks.4.7.0.nupkg'.
        Response status code does not indicate success: 400 (Bad Request - The package is invalid: The package version had build metadata. We do not support versions with build metadata (VSTS Activity ID: F5D3827A-AEFC-405B-B626-BC50D19ED1E6)).
        The feed 'ToolBelt.SalesDistribution [https://tuires.pkgs.visualstudio.com/_packaging/ToolBelt.SalesDistribution/nuget/v3/index.json]'; lists package 'NuGet.Frameworks.4.7.0' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.
        Unable to find package 'NuGet.Frameworks.4.7.0'.)

        Packages failed to restore
        ```

      • Erik commented  ·   ·  Flag as inappropriate

        I am getting the following error after upgrading to NET2.1:

        error : Failed to download package 'NuGet.Frameworks.4.7.0' from 'https://----.pkgs.visualstudio.com/_packaging/----/nuget/v3/flat2/nuget.frameworks/4.7.0/nuget.frameworks.4.7.0.nupkg'.
        error : Response status code does not indicate success: 400 (Bad Request - The package is invalid: The package version had build metadata. We do not support versions with build metadata
        error : The feed '[https://----.pkgs.visualstudio.com/_packaging/----/nuget/v3/index.json]'; lists package 'NuGet.Frameworks.4.7.0' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.
        error : Unable to find package 'NuGet.Frameworks.4.7.0'.

        It looks like the package update that doesn't work is: Microsoft.Applicat Installing Microsoft.ApplicationInsights.AspNetCore 2.3.0.

        NuGet.Protocol.Core.Types.FatalProtocolException: The feed '[https://----.pkgs.visualstudio.com/_packaging/----/nuget/v3/index.json]'; lists package 'NuGet.Frameworks.4.7.0' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again. ---> NuGet.Protocol.PackageNotFoundProtocolException: Unable to find package 'NuGet.Frameworks.4.7.0'.
        at NuGet.Protocol.FindPackagesByIdNupkgDownloader.GetNuspecReaderFromNupkgAsync(PackageIdentity identity, String url, SourceCacheContext cacheContext, ILogger logger, CancellationToken token)
        at NuGet.Protocol.HttpFileSystemBasedFindPackageByIdResource.GetDependencyInfoAsync(String id, NuGetVersion version, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
        at NuGet.Commands.SourceRepositoryDependencyProvider.GetDependenciesCoreAsync(LibraryIdentity match, NuGetFramework targetFramework, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken)
        at NuGet.Commands.SourceRepositoryDependencyProvider.<>c__DisplayClass20_0.<<GetDependenciesAsync>b__0>d.MoveNext()

        Locally it works without a problem (VS 2017 15.7.5). We are using VSTS Package manager for shared packages internally between different solutions (apps). I would expect other people will run into this problem soon, seeing Microsoft.ApplicationInsights.AspNetCore 2.3.0 is an often used nuget package.

        Is there a way to work around this?

      • Wilbert van Dolleweerd commented  ·   ·  Flag as inappropriate

        Seconded. SemVer 2.0 specifically allows the following:

        "
        Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata SHOULD be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85.
        "

        I have a build process that injects AssemblyInformationalVersion in all AssemblyInfo.cs files with the following information:

        AssemblyInformationalVersion="$(Major).$(Minor).$(Revision)+Build$(Build)SHA$(GitHash)"

        (Where GitHash is the SHA for the Git Commit). This is allowed by SemVer 2.0 specifications but fails on NuGet push with the following error:

        Microsoft.VisualStudio.Services.NuGet.WebApi.Exceptions.InvalidPackageException: The package is invalid: The package version had build metadata. We do not support versions with build metadata

      Feedback and Knowledge Base