nuke
nuke copied to clipboard
ToolPathResolver not working on Ubuntu --> System.Exception: Missing package reference/download.
Usage Information
Nuke.Common 6.2.1 / net5.0 / net6.0 / Ubuntu 20.04
Description
On an Ubuntu machine, the ToolPathResolver can not resolve the Tool paths.
For tools like ReportGenerator or dotnet-sonarscanner, nuke is reporting always the following error on an Ubuntu machine:
System.Exception: Missing package reference/download.
Run one of the following commands:
- nuke :add-package ReportGenerator --version 5.1.10
Same configuration works with a windows machine!
Reproduction Steps
- Configure a tool in csproj like:
Example with ReportGenerator:
<PackageDownload Include="ReportGenerator" Version="[5.1.10]" />
also tested with
<PackageReference Include="ReportGenerator" Version="5.1.10" />
Do it with:
nuke :add-package ReportGenerator --version 5.1.10
- Use the Tool in nuke:
ReportGenerator(s => s
.SetFramework("net5.0")
.SetReports(openCoverageFilesPerAssembly)
.SetTargetDirectory(CoverageHtmlDirectory)
.SetReportTypes(ReportTypes.HtmlInline_AzurePipelines_Dark));
-
Run Build on Windows --> works!
-
Run Build on Ubuntu 20.04 --> Error with message:
System.Exception: Missing package reference/download.
Run one of the following commands:
nuke :add-package ReportGenerator --version 5.1.10
Expected Behavior
ToolPathResolver should be able to resolve the correct tool path independent of the operating system.
Actual Behavior
Error on Ubuntu 20.04:
βIt reports to install the tool like: nuke :add-package ReportGenerator --version 5.1.10 --> but that is how it was done.
Full stack trace: 13:52:32 [ERR] Target Test has thrown an exception **System.Exception: Missing package reference/download. Run one of the following commands:
- nuke :add-package ReportGenerator --version 5.1.10 ---> System.ArgumentException: Could not find package 'ReportGenerator' using:**
- Project assets file '/home/ubuntu/_work/1/s/build/obj/project.assets.json'
- NuGet packages config '/home/ubuntu/work/1/s/build/build.csproj'
at Nuke.Common.Assert.NotNull[T](T obj, String message, String argumentExpression) in //source/Nuke.Common/Assert.cs:line 61
at Nuke.Common.Tooling.ToolPathResolver.GetPackageDirectory(String[] packageIds, String version) in //source/Nuke.Common/Tooling/ToolPathResolver.cs:line 94
--- End of inner exception stack trace ---
at Nuke.Common.Assert.Fail(String message, Exception exception) in //source/Nuke.Common/Assert.cs:line 22
at Nuke.Common.Tooling.ToolPathResolver.GetPackageDirectory(String[] packageIds, String version) in //source/Nuke.Common/Tooling/ToolPathResolver.cs:line 154
at Nuke.Common.Tooling.ToolPathResolver.GetPackageExecutable(String packageId, String packageExecutable, String version, String framework) in //source/Nuke.Common/Tooling/ToolPathResolver.cs:line 41
at Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks.GetToolPath(String framework) in //source/Nuke.Common/Tools/ReportGenerator/ReportGeneratorTasks.cs:line 35
at Nuke.Common.Tools.ReportGenerator.ReportGeneratorSettings.GetProcessToolPath() in //source/Nuke.Common/Tools/ReportGenerator/ReportGeneratorTasks.cs:line 27
at Nuke.Common.Tools.ReportGenerator.ReportGeneratorSettings.get_ProcessToolPath() in //source/Nuke.Common/Tools/ReportGenerator/ReportGenerator.Generated.cs:line 131
at Nuke.Common.Tooling.ProcessTasks.StartProcess(ToolSettings toolSettings) in //source/Nuke.Common/Tooling/ProcessTasks.cs:line 55
at Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks.ReportGenerator(ReportGeneratorSettings toolSettings) in //source/Nuke.Common/Tools/ReportGenerator/ReportGenerator.Generated.cs:line 68
at Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks.ReportGenerator(Configure
1 configurator) in /_/source/Nuke.Common/Tools/ReportGenerator/ReportGenerator.Generated.cs:line 93 at Build.CreateCodeCoverageReport() in /home/ubuntu/_work/1/s/build/Build.Testing.cs:line 54 at Build.<get_Test>b__46_1() in /home/ubuntu/_work/1/s/build/Build.Testing.cs:line 41 at Nuke.Common.Execution.BuildExecutor.<>c.<Execute>b__4_2(Action x) in /_/source/Nuke.Common/Execution/BuildExecutor.cs:line 112 at Nuke.Common.Utilities.Collections.EnumerableExtensions.ForEach[T](IEnumerable
1 enumerable, Action1 action) in /_/source/Nuke.Common/Utilities/Collections/Enumerable.ForEach.cs:line 17 at Nuke.Common.Execution.BuildExecutor.Execute(NukeBuild build, ExecutableTarget target, IReadOnlyCollection
1 previouslyExecutedTargets, Boolean failureMode) in /_/source/Nuke.Common/Execution/BuildExecutor.cs:line 112
Regression?
It worked always on windows, not sure if it was working on ubuntu in earlier versions.
Known Workarounds
Update: It only happens when a globalPackagesFolder is specified in the nuget.config file like:
<config>
<add key="globalPackagesFolder" value="packages" />
</config>
Disabling this config makes it work on the Ubuntu machine. But it should also work with a configured globalPackagesFolder.
can you please create a github repo?
Thanks for your fast response!
Funny thing: after spending hours of testing, I decided to create a bug report, because I had no other lead. After that I realized that I have a globalPackagesFolder config in my repo NuGet.Config:
<config> <add key="globalPackagesFolder" value="packages" /> </config>
So all nuget packages including the references from the _build.csproj are fetched into: {repo-root}/packages After disabling this config and use the default packages folder, it works also on the Ubuntu machine!
Can you check if Nuke is somehow not considering this setting and looks in the wrong place for the tools. It should also work with globalPackagesFolder setting enabled.
No, it doesn't consider nuget.config
, but glad it's working now.
No, it doesn't consider
nuget.config
, but glad it's working now.
Yes, but it should.
Actually, it does, but I believe you're running into an issue with case-sensitivity. Try nuget.config
.