diff --git a/src/cscs/NuGet.Core.cs b/src/cscs/NuGet.Core.cs index bff57e16..499fd634 100644 --- a/src/cscs/NuGet.Core.cs +++ b/src/cscs/NuGet.Core.cs @@ -61,7 +61,7 @@ class NuGetCore public bool NewPackageWasInstalled { get; set; } - public void InstallPackage(string packageNameMask, string version = null) + public void InstallPackage(string packageNameMask, string version = null, string nugetArgs = null) { var packages = new string[0]; //index is 1-based, exactly as it is printed with ListPackages @@ -102,7 +102,13 @@ public void InstallPackage(string packageNameMask, string version = null) var ver = ""; if (version != null) ver = "-v " + version; - "dotnet".Run($"add package {name} {ver}", nuget_dir, x => Console.WriteLine(x)); + + if (string.IsNullOrEmpty(nugetArgs)) + nugetArgs = ""; + + // Syntax: dotnet add package [options] + string commandLine = $"add package {ver} {nugetArgs} {name}"; + "dotnet".Run(commandLine, nuget_dir, x => Console.WriteLine(x)); } // intercept and report incompatible packages (maybe) @@ -390,7 +396,7 @@ public string[] Resolve(string[] packages, bool suppressDownloading, string scri try { - InstallPackage(package, packageVersion); + InstallPackage(package, packageVersion, nugetArgs); package_info = FindPackage(package, packageVersion); this.NewPackageWasInstalled = true; }