sdk: [8.0.100-rc.2.23469.4] some deprecated global tools get NuGetPackageNotFoundException when installing

Issue Description: When installing these global tools with “dotnet tool install” command, NuGetPackaeNotFoundException will be thrown on dotnet-sdk-8.0.100-rc.2.23469.4. But they are installed successful with dotnet-sdk-8.0.100-rc.2.23466.1.

Application Name: Elemental.SysInfoTool, dotnet-giio, dotnet-sqldb OS: Windows 10 21H2 CPU: X64 .NET Build Number: dotnet-sdk-8.0.100-rc.2.23469.4

Verify Scenarios:

  1. Windows10 21h2 x64 + dotnet-sdk-8.0.100-rc.2.23469.4: Fail
  2. Windows10 21h2 x64 + dotnet-sdk-8.0.100-rc.2.23466.1: Pass

Repro steps: The machine only has 8.0.100-rc.2.23469.4 installed and set DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX environment variable as 2.

  1. Open cmd.exe form %windir%\System32
  2. Input ‘dotnet tool install -g Elemental.SysInfoTool’
  3. Press keyboard ‘Enter’

Expected Result: Elemental.SysInfoTool install successful.

Actual Result: Install failed with following exception:

Unhandled exception: Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageNotFoundException: elemental.sysinfotool::[*, ) is not found in NuGet feeds https://api.nuget.org/v3/index.json, https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json, https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json, https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json, https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json, https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json, https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json, https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev, https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json, https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json, https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json, https://pkgs.dev.azure.com/dnceng/internal/_packaging/6.0.414-servicing.23416.29-shipping/nuget/v3/index.json".

   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetMatchingVersionInternalAsync(String packageIdentifier, IEnumerable`1 packageSources, VersionRange versionRange, CancellationToken cancellationToken)
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.GetBestPackageVersionAsync(PackageId packageId, VersionRange versionRange, PackageSourceLocation packageSourceLocation)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass8_0.<InstallPackage>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)

Findings: These tools do not exist in NuGet Gallery | Packages And their details page marked them as deprecated and cannot be used anymore. For example, this is the Elemental.SysInfoTool tool page. But we can install this tool successfully when we have earlier SDK installed in our machine.
This issue seems related to https://github.com/dotnet/sdk/commit/81140426e38ac2e3071c23ac5c66803d63e8aa7c

@dotnet-actwx-bot @dotnet/compat

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 23 (16 by maintainers)

Most upvoted comments

PR https://github.com/dotnet/sdk/pull/36671 was merged to the release/8.0.1xx branch in commit 5a7019c5acf54e2e8a91e2b64c342e5a7ffc0275, but it seems the GetBestPackageVersionAsync change in src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs was not correctly merged to the release/8.0.2xx branch in commit 7d995fce293917e817f63d0a41808dfc6779a034 (PR https://github.com/dotnet/sdk/pull/36874). Commit 6c74ad6e3c814f32538e9fd2ccfece683bf6bfbb in PR https://github.com/dotnet/sdk/pull/36641 to release/8.0.2xx had added a space in if ( and caused a merge conflict that was resolved incorrectly.

$ git show --diff-merges=remerge 7d995fce293917e817f63d0a41808dfc6779a034 -- src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
commit 7d995fce293917e817f63d0a41808dfc6779a034
Merge: a1c5ff764e 91840a4e2e
Author: v-codyguan <v-codyguan@microsoft.com>
Date:   Wed Nov 15 07:03:30 2023 +0000

    Merge branch 'release/8.0.1xx' into release/8.0.2xx

diff --git a/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs b/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
remerge CONFLICT (content): Merge conflict in src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
index 3d0a8466eb..933f561d98 100644
--- a/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
+++ b/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
@@ -559,12 +559,7 @@ private string GenerateVersionRangeErrorDescription(string packageIdentifier, Ve
             VersionRange versionRange,
              PackageSourceLocation packageSourceLocation = null)
         {
-<<<<<<< a1c5ff764e ([release/8.0.2xx] Update dependencies from dotnet/razor (#36863))
             if (versionRange.MinVersion != null && versionRange.MaxVersion != null && versionRange.MinVersion == versionRange.MaxVersion)
-=======
-            if (versionRange.MinVersion != null && !versionRange.IsFloating &&
-                (versionRange.MaxVersion == null || versionRange.MinVersion == versionRange.MaxVersion))
->>>>>>> 91840a4e2e (Update manpages for 8.0 (#36447))
             {
                 return versionRange.MinVersion;
             }

@Junjun-zhao A change that accept the bare version as NuGet exact version was merged

Maybe the brackets make sense in dotnet add package; but I don’t think version ranges are useful in dotnet tool install. There are no transitive references to .NET tool packages, so NuGet never has to choose a tool version that satisfies multiple constraints.

Update: The unlist tool can be successfully installed when a version is specified and enclosed in square brackets(install the Exact version match). The above validation which just mentioned the version, actually it is a range (X >=Version) according to the document https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#version-basics

For example: dotnet tool install --global Elemental.SysInfoTool --version [0.5.0] image

The only thing to need your kindly confirm is whether we will be creating a breaking document for this? @JL03-Yue @marcpopMSFT @KalleOlaviNiemitalo

I’m experiencing the same issue when restoring in Azure DevOps a project that references Microsoft Tye 0.11 since RC2 went live.

The same issue doesn’t happen on my local machine.

$ dotnet --version
8.0.100-rc.2.23502.2

See for more details the issue on the Tye repo: https://github.com/dotnet/tye/issues/1615