Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet tool restore installing wrong version specified in dotnet-tools.json #36434

Closed
fedele7008 opened this issue Oct 24, 2023 · 8 comments
Closed
Assignees
Labels
Area-Tools untriaged Request triage from a team member

Comments

@fedele7008
Copy link

Describe the bug

Trying to dotnet tool restore some specific version of dotnet-format, and it will restore wrong version that is specified on the dotnet-tools.json

To Reproduce

Prereq is to use .NET 8.0 SDK rc2 version (could not reproduce same issue from rc1)
and we have following settings:

.config/dotnet-tools.json

{
  "version": 1,
  "isRoot": true,
  "tools": {
    "dotnet-format": {
      "version": "8.0.452306",
      "commands": ["dotnet-format"]
    }
  }
}

NuGet.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
  </packageSources>

  <packageSourceMapping>
    <packageSource key="nuget.org">
      <package pattern="*" />
    </packageSource>
    <packageSource key="dotnet-tools">
      <package pattern="dotnet-format" />
    </packageSource>
  </packageSourceMapping>
</configuration>

Then running dotnet tool restore will prompt that dotnet-format of version 8.0.452306 is installed, but if we actually check .nuget/packages/dotnet-format we have 8.0.452407 version instead.

Exceptions (if any)

Note that this bug is not reproduced on rc1.

Further technical details

result of dotnet --info

.NET SDK:
 Version:   8.0.100-rc.2.23502.2
 Commit:    0abacfc2b6

런타임 환경:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win-arm64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100-rc.2.23502.2\

설치된 .NET 워크로드:
표시할 설치된 워크로드가 없습니다.

Host:
  Version:      8.0.0-rc.2.23479.6
  Architecture: arm64
  Commit:       0b25e38ad3

.NET SDKs installed:
  6.0.414 [C:\Program Files\dotnet\sdk]
  7.0.401 [C:\Program Files\dotnet\sdk]
  8.0.100-rc.1.23455.8 [C:\Program Files\dotnet\sdk]
  8.0.100-rc.2.23502.2 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-rc.1.23421.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-rc.2.23480.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-rc.1.23419.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-rc.2.23479.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0-rc.1.23420.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0-rc.2.23479.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x64   [C:\Program Files\dotnet\x64]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation]
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@sliekens
Copy link

I also hit this problem

image

@virzak
Copy link

virzak commented Oct 25, 2023

A temporary solution is to create a feed on myget or another provider and populate it with a single version of a package that's required.
Here is one I created for dotnet-format

@manfred-brands
Copy link

I also have this problem on RC2, dropping back to RC1 fixes the issue.

image

manfred-brands added a commit to ashishdawale20/nunit that referenced this issue Nov 1, 2023
virzak added a commit to zompinc/sync-method-generator that referenced this issue Nov 3, 2023
@JL03-Yue
Copy link
Member

JL03-Yue commented Nov 6, 2023

This should be fixed in #35884. Does the problem still occur?

@manfred-brands
Copy link

This should be fixed in #35884. Does the problem still occur?

Is there a newer version then RC2 that I can test.
In my case there is only a single package configured, so not a concurrency problem.

@sliekens
Copy link

Tested with .NET 8.0 (GA), it's no longer a problem for me.

@manfred-brands
Copy link

Yes, works for me now as well.

@JL03-Yue
Copy link
Member

Close as fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Tools untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

5 participants