Skip to content

Commit

Permalink
Merge pull request #263 from husk3r/nuget
Browse files Browse the repository at this point in the history
Use and forward additional nuget arguments
  • Loading branch information
oleg-shilo authored Dec 4, 2021
2 parents e0f98cf + c2e58f1 commit 2d3cf8a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/cscs/NuGet.Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <PROJECT (optional)> package [options] <PACKAGE_NAME>
string commandLine = $"add package {ver} {nugetArgs} {name}";
"dotnet".Run(commandLine, nuget_dir, x => Console.WriteLine(x));
}

// intercept and report incompatible packages (maybe)
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2d3cf8a

Please sign in to comment.