Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet install fails for prefixed packages #2629

Closed
rkm opened this issue Dec 6, 2022 · 0 comments · Fixed by #2641
Closed

dotnet install fails for prefixed packages #2629

rkm opened this issue Dec 6, 2022 · 0 comments · Fixed by #2641

Comments

@rkm
Copy link
Contributor

rkm commented Dec 6, 2022

search you tried in the issue tracker

dotnet tool

describe your issue

A bit of an oversight when constructing tool_name here:

# Determine tool from the packaged file <tool_name>.<version>.nupkg
build_outputs = os.listdir(os.path.join(prefix.prefix_dir, build_dir))
for output in build_outputs:
tool_name = output.split('.')[0]

E.g.

$ pre-commit try-repo https://github.com/rkm/sample-dotnet-tool
[INFO] Initializing environment for https://github.com/rkm/sample-dotnet-tool.
===============================================================================
Using config:
===============================================================================
repos:
-   repo: https://github.com/rkm/sample-dotnet-tool
    rev: e53a3601bc06bb038dac30da813572291dd8d58f
    hooks:
    -   id: sample-dotnet-tool
===============================================================================
[INFO] Installing environment for https://github.com/rkm/sample-dotnet-tool.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/rkm/bin/dotnet', 'tool', 'install', '--tool-path', '/tmp/tmp6bk4v26x/repotefhurdg/dotnetenv-default/bin', '--add-source', 'pre-commit-build', 'Rkm')
return code: 1
expected return code: 0
stdout:
    /tmp/1873db78-d0a7-48ba-bbff-10a7ef85a2a6/restore.csproj : error NU1101: Unable to find package rkm. No packages exist with this id in source(s): /tmp/tmp6bk4v26x/repotefhurdg/pre-commit-build, nuget.org

stderr:
    The tool package could not be restored.
    Tool 'rkm' failed to install. This failure may have been caused by:

    * You are attempting to install a preview release and did not use the --version option to specify the version.
    * A package by this name was found, but it was not a .NET tool.
    * The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
    * You mistyped the name of the tool.

    For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool

Check the log at /home/rkm/.cache/pre-commit/pre-commit.log

pre-commit --version

pre-commit 2.20.0

.pre-commit-config.yaml

repos:
-   repo: https://github.com/rkm/sample-dotnet-tool
    rev: e53a3601bc06bb038dac30da813572291dd8d58f
    hooks:
    -   id: sample-dotnet-tool

~/.cache/pre-commit/pre-commit.log (if present)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant