From e4158179d0f41e7d47cea06d6d1ef4b0b0556395 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Sun, 27 Aug 2017 17:22:55 -0500 Subject: [PATCH] (GH-1155) More comprehensive warn on nupkg/nuspec use When using nupkg or nuspec, ensure the command checking is looking at whether "pack " is being called instead of just seeing "pack" in "package-parameters", which doesn't provide the warning it was designed to provide. --- src/chocolatey.console/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chocolatey.console/Program.cs b/src/chocolatey.console/Program.cs index 00029ab0b1..a4359948b9 100644 --- a/src/chocolatey.console/Program.cs +++ b/src/chocolatey.console/Program.cs @@ -165,7 +165,8 @@ private static void Main(string[] args) private static void warn_on_nuspec_or_nupkg_usage(string[] args, ChocolateyConfiguration config) { - if (!args.Any(a => a.contains("pack") || a.contains("push")) && args.Any(a => a.contains(".nupkg") || a.contains(".nuspec"))) + var commandLine = Environment.CommandLine; + if (!(commandLine.contains(" pack ") || commandLine.contains(" push ")) && (commandLine.contains(".nupkg") || commandLine.contains(".nuspec"))) { if (config.RegularOutput) "chocolatey".Log().Warn("The use of .nupkg or .nuspec in for package name or source is known to cause issues. Please use the package id from the nuspec `` with `-s .` (for local folder where nupkg is found)."); }