dotnet / dotnet/format

Pinning the version of dotnet-format

Open
#1,641 7 comments 7 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

Hello all,

Since dotnet-format is now a part of the [SDK](https://github.com/dotnet/format/issues/1268) 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

```json
{
"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!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.