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:
Navigate to the root directory of the solution in PowerShell
Enter command nuke to build the project successfully using Build.cs from the _build project
Enter command dotnet pack to package the Nuke build as a global tool
Enter command dotnet tool install --global --add-source .\artifacts MyGlobalTool to install the global tool
Enter command my-command to execute the build from the global tool which will fail
Enter command dotnet tool uninstall --global MyGlobalTool to remove the global tool
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:
394
396
437
Known Workarounds
None
Could you help with a pull-request?
Yes, in theory, but I don't currently know how to solve the problem.
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:
nuke
to build the project successfully usingBuild.cs
from the_build
projectdotnet pack
to package the Nuke build as a global tooldotnet tool install --global --add-source .\artifacts MyGlobalTool
to install the global toolmy-command
to execute the build from the global tool which will faildotnet tool uninstall --global MyGlobalTool
to remove the global toolnuke-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:
Regression?
This worked in
5.2.1
. It does not work in7.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:394
396
437
Known Workarounds
None
Could you help with a pull-request?
Yes, in theory, but I don't currently know how to solve the problem.