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

PackageDownload dependencies cannot be found by global tools #1377

Open
elodon opened this issue May 10, 2024 · 0 comments
Open

PackageDownload dependencies cannot be found by global tools #1377

elodon opened this issue May 10, 2024 · 0 comments
Labels

Comments

@elodon
Copy link

elodon commented May 10, 2024

Usage Information

Nuke 8.0.0 / SDK 6.0.321 / .NET 6.0 / Windows 11

Description

Publishing a global tool version of a Nuke build with dependencies defined with the PackageDownload feature results in errors for missing packages when trying to execute the global tool.

Reproduction Steps

I have attached a Minimal Reproducible Example (MRE). This behavior can be reproduced by:

  1. Navigate to the root directory of the solution in PowerShell
  2. Enter command nuke to build the project successfully using Build.cs from the _build project
  3. Enter command dotnet pack to package the Nuke build as a global tool
  4. Enter command dotnet tool install --global --add-source .\artifacts MyGlobalTool to install the global tool
  5. Enter command my-command to execute the build from the global tool which will fail
  6. Enter command dotnet tool uninstall --global MyGlobalTool to remove the global tool

nuke-global-tool-repro.zip

Expected Behavior

Dependencies defined with the PackageDownload feature (e.g. GitVersion.Tools) would be packed into the global tool such that they can be referenced when executing the global tool.

Actual Behavior

Attempts to reference PackageDownload dependencies when executing the global tool result in missing package errors which fail the build, such as:

Could not inject value for Build.GitVersion
System.Exception: Missing package reference/download.
Run one of the following commands:
  - nuke :add-package GitVersion.Tool --version 5.12.0
  - nuke :add-package GitVersion.CommandLine --version 5.12.0
 ---> System.ArgumentException: Could not find package 'GitVersion.Tool' or 'GitVersion.CommandLine'

Regression?

This worked in 5.2.1. It does not work in 7.0.5. I am not sure about the versions in between. I believe this is a recurrence of an issue previously addressed multiple times in 2020:

Known Workarounds

None

Could you help with a pull-request?

Yes, in theory, but I don't currently know how to solve the problem.

@elodon elodon added the bug label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant