Skip to content

dotnet-tools.json: add path to project installed tool #37450

Open
@MerijnHendriks

Description

@MerijnHendriks

Is your feature request related to a problem? Please describe.

I want to install tools for one project specifically and want it installed to the project directory, as well as it being reinstalled to this path when someone else runs dotnet tool restore.

I can already install the tool to my project using --tool-path with local tool install, However, the path itself is not stored in the project's dotnet-tools.json. Thus, when I restore the tools on another machine using dotnet tool restore, it does not restore at the specified relative path.

I expected this feature to be here since Nuget.config already supports this for a long time. It is odd to me that dotnet-tools.json doesn't support this use-case.

Describe the solution you'd like

Like with Nuget.config, I would like the config to store the relative install path. If this would break behaviour, I suggest adding the --project-tool switch to enable this functionality.

As example:

dotnet tool install --project-tool --tool-path=./nuget/tools/ dotnet-coverage

Inside the config, it would look like this:

{
  "version": 2,
  "isRoot": true,
  "tools": { 
    // a local/global tool
    "dotnet-reportgenerator-globaltool": {
      "version": "5.2.0",
      "commands": [
        "reportgenerator"
      ]
    },
    // a project tool
    "dotnet-coverage": {
      "path": "./nuget/tools/dotnet-coverage"
      "version": "17.9.3",
      "commands": [
        "dotnet-coverage"
      ]
    }
  }
}

Why this solution?

Sometimes I have to use multiple projects with different tool versions that are incompatible. Having a large userbase manually install the right tool version at the right path is a problem. Having to write setup scripts for this is problematic because it's non-standard.

This solution would minimize the risk of failure on installation, and seems like a small enough change to not require extensive modification in the tool manifest or dotnet tool command.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions