Skip to content

Commit cb5a72c

Browse files
committed
Fix AddPackage command to allow explicit version parameter
1 parent 5f3863d commit cb5a72c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

source/Nuke.Common/Tooling/ToolPathResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ from packageVersion in
157157
{
158158
"Missing package reference/download.",
159159
"Run one of the following commands:"
160-
}.Concat(packageCombinations.Distinct().Select(x => $" - nuke :add-package {x.Id} {x.Version}"))
160+
}.Concat(packageCombinations.Distinct().Select(x => $" - nuke :add-package {x.Id} --version {x.Version}"))
161161
.JoinNewLine(),
162162
exception);
163163
throw new Exception("Not reachable");

source/Nuke.GlobalTool/Program.AddPackage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public static int AddPackage(string[] args, [CanBeNull] AbsolutePath rootDirecto
2323
{
2424
var packageId = args.ElementAt(0);
2525
var packageVersion =
26-
(args.ElementAtOrDefault(1) ??
26+
(EnvironmentInfo.GetParameter<string>("version") ??
27+
args.ElementAtOrDefault(1) ??
2728
NuGetPackageResolver.GetLatestPackageVersion(packageId, includePrereleases: false).GetAwaiter().GetResult() ??
2829
NuGetPackageResolver.GetGlobalInstalledPackage(packageId, version: null, packagesConfigFile: null)?.Version.ToString())
2930
.NotNull("packageVersion != null");

0 commit comments

Comments
 (0)