.net.net-coredotnet-tool

Is it possible to use wild card versions for dotnet global/local tools?


We use the normal dotnet-tools.json for setting up our dotnet local tools for our project but was wondering if there is a way to use wild card versions for the version numbers like you can do within csprojs with package references?

<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0-rc.1.*" />

I've tried changing the dotnet-tools.json to the following:

{
  "version": 1,
  "isRoot": true,
  "tools": {
    "dotnet-ef": {
      "version": "5.0.0-rc.1.*",
      "commands": [
        "dotnet-ef"
      ]
    }
  }
}

However running dotnet tool restore gives the following error

Invalid manifest file. Path C:\dev\x\x.api\.config\dotnet-tools.json:
        In package dotnet-ef:
                Version 5.0.0-rc.1.* is invalid.

Solution

  • Locating where error message originated in code, you can see that the version parsing is done by NugetVersion.TryParse which only allow semver-strings.
    So it isn't possible to add wildcards.