Skip to content

Pinning the version of dotnet-format #1641

Open
@zubivan

Description

Hello all,

Since dotnet-format is now a part of the SDK it potentially poses an issue when upgrading the sdk might potentially change the behaviour of the tool, e.g. new rules are pickled up or introduced.

Is there a way to pin the version of the tool now? It's especially important in case of the CI/CD environment in multi-version product companies where reproducible builds are important (think patch releases for older builds).

Before the tool was moved to the sdk one could pin it in such a way:

Add .config/dotnet-tools.json in the root of your repository with the following contents

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

During the CI run something like

dotnet tool restore
dotnet tool run dotnet-format $ARGS

Is there a way to achieve similar behaviour with the current setup?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions