question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pre-commit requires preview sdk

See original GitHub issue

Reproduce steps:

  1. Make sure there is no net6-preview sdk installed globally
  2. Use following .pre-commit-config.yaml
repos:
-   repo: https://github.com/dotnet/format
    rev: "v5.1.225507"  # Specify a tag or sha here, or run "pre-commit autoupdate"
    hooks:
    -   id: dotnet-format
  1. Type pre-commit run

Expected result:

Everything fine

Actual result:

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-preview.1.21103.13] from [C:\Users\leo\.cache\pre-commit\repo5e5uh95j\global.json] was not found.
          Install the [6.0.100-preview.1.21103.13] .NET SDK or update [C:\Users\leo\.cache\pre-commit\repo5e5uh95j\global.json] with an installed .NET SDK:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
leotsarevcommented, Sep 27, 2021

After investigation, another option will be just use pre-commit “local” mode to use dotnet format installed as local tool / part of sdk and skip downloading at all.

I’ll update integrations.md with info about this option. PR will follow 😃

0reactions
JoeRobichcommented, Sep 27, 2021

Hi @leotsarev, You seem to have run into the same issue as https://github.com/dotnet/format/issues/1318.

I think pre-commit dotnet integration should have mode to use dotnet-tools.json

I agree. I thought it was an interesting choice to build our tool locally when running pre-commit. We welcome pull requests to make this experience better.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pre-commit
Before you can run hooks, you need to have the pre-commit package manager installed. Using pip: pip install pre-commit. In a python project,...
Read more >
How can I enforce black's `--preview` option when invoking ...
0, in a Python 3.9.9 venv). Now I'd like to make sure that enforcement happens with every commit, using pre-commit, but I don't...
Read more >
Supported hooks
check-autopkg-recipe-list - This hook checks AutoPkg recipe lists (in txt, plist, yaml, or json format) for common issues. check-autopkg-recipes - This hook ...
Read more >
Pre-commit | GitGuardian documentation
ggshield is a wrapper around GitGuardian API for secrets detection that requires an API key to work. Preview#. pre-commit preview. Installation#. The pre-commit...
Read more >
Pre-push | GitGuardian documentation
... GitGuardian API for secrets detection that requires an API key to work. ... pre-push preview ... Make sure you have the pre-commit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found