Skip to content

pre-commit version doesn't seem to use the latest .net sdk installed  #1318

@mikeage

Description

@mikeage

Sorry, I'm not an expert in dotnet and I might be doing something wrong, but here's what I've run:
Install dotnet sdk preview: brew install dotnet-sdk-preview
Configure pre-commit, pointing to the latest version:

---
repos:
    rev: "2c6ded76878d585a4f037c32ba0fbb2685f27b05"  # master as of 2021-09-02
    hooks:
      - id: dotnet-format
        exclude: ^(Assets/ThirdParty)|(Packages/)
        args:
          - --folder
          - --include

Run pre-commit

$ pre-commit run -a
[INFO] Installing environment for https://github.com/dotnet/format.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/usr/local/bin/dotnet', 'pack', '--configuration', 'Release', '--output', 'pre-commit-build')
return code: 145
expected return code: 0
stdout:
            6.0.100-preview.7.21379.14 [/usr/local/share/dotnet/sdk]

stderr:
    Could not execute because the application was not found or a compatible .NET SDK is not installed.
    Possible reasons for this include:
      * You intended to execute a .NET program:
          The application 'pack' does not exist.
      * You intended to execute a .NET SDK command:
          A compatible installed .NET SDK for global.json version [6.0.100-rc.1.21379.2] from [/Users/mikemi/.cache/pre-commit/repo087kphn7/global.json] was not found.
          Install the [6.0.100-rc.1.21379.2] .NET SDK or update [/Users/mikemi/.cache/pre-commit/repo087kphn7/global.json] with an installed .NET SDK:

Check the log at /Users/mikemi/.cache/pre-commit/pre-commit.log

If I update the global.json to point to 6.0.100-preview.7.21379.14 instead of 6.0.100-rc.1.21379.2 then it's happy, but shouldn't it be taking the latest regardless of global.json, as mentioned in #1292 ("We now use the highest version .NET 6 SDK that is installed rather than trying to match the global.json configuration.")

Metadata

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