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 cannot find the local manifest file #33921

Closed
bjornhandersson opened this issue Jul 11, 2023 · 6 comments
Closed

dotnet tool restore cannot find the local manifest file #33921

bjornhandersson opened this issue Jul 11, 2023 · 6 comments
Assignees
Labels
Area-Tools untriaged Request triage from a team member

Comments

@bjornhandersson
Copy link

Describe the bug

After upgrading dotnet to 7.0.9, dotnet tool restore cannot find the manifest file in .config/dotnet-tools.json

It returns:

Cannot find a manifest file.
For a list of locations searched, specify the "-d" option before the tool name.
No tools were restored.

Running dotnet new tool-manifest will reset the manifest file and after adding the tools it still do not pick those tools up.

Affected platforms

This only happens on Windows. MacOS seems to work. Have not tried linux.

To Reproduce

  1. Run dotnet new tool-manifest
  2. Add a tool. See example below. (running dotnet tool install Cake.Tool --version 3.1.0 will also fail with same error)
  3. Run dotnet tool restore

.config/dotnet-tools.json

{
  "version": 1,
  "isRoot": true,
  "tools": {
    "cake.tool": {
      "version": "3.1.0",
      "commands": [
        "dotnet-cake"
      ]
    }
  }
}

Further technical details

dotnet --info

.NET SDK:
 Version:   7.0.306
 Commit:    f500069cb7

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.306\

Host:
  Version:      7.0.9
  Architecture: x64
  Commit:       8e9a17b221

.NET SDKs installed:
  5.0.405 [C:\Program Files\dotnet\sdk]
  7.0.103 [C:\Program Files\dotnet\sdk]
  7.0.304 [C:\Program Files\dotnet\sdk]
  7.0.306 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  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
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Tools untriaged Request triage from a team member labels Jul 11, 2023
@baronfel
Copy link
Member

@JL03-Yue can you take a look at this? It might be related to your recent fix.

@bjornhandersson bjornhandersson changed the title dotnet tool restore is not finding the local manifest file dotnet tool restore cannot find the local manifest file Jul 11, 2023
@bjornhandersson
Copy link
Author

bjornhandersson commented Jul 11, 2023

Some more info:

This only happens when the source code is placed in the root like X:\ so it's kind of an edge-case but it used to work.

To reproduce:

subst x: c:\path\to\source
cd x:
dotnet tool restore

@JL03-Yue
Copy link
Member

@bjornhandersson

In the latest version of dotnet, we made a change to not looking at the root for manifest file for security reasons for windows. This might affect the outcome of your command

@iskiselev
Copy link

I was also affected by it. We use subst to workaround some tools that don't work on docker-mounted folders directly by works on subst drive for it and to make stable path written in pdb. With it, root of repository become root of drive - and it is very inconvenient that dotnet tool restore doesn't work for it.

@KalleOlaviNiemitalo
Copy link

The breaking change document Tool manifests in root folder mentions that the original behaviour can be restored by setting the DOTNET_TOOLS_ALLOW_MANIFEST_IN_ROOT environment variable.

@JL03-Yue JL03-Yue closed this as completed Sep 5, 2023
@JL03-Yue
Copy link
Member

JL03-Yue commented Sep 5, 2023

Thank you @KalleOlaviNiemitalo, the original behaviour can be restored by setting the DOTNET_TOOLS_ALLOW_MANIFEST_IN_ROOT environment variable.

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