Add Runtime Identifier option to dotnet-restore

* Add an option to specify an RID when restoring
* This brings the option from the publish and build command to the restore command
This commit is contained in:
Alex Barney 2016-12-18 22:42:54 -06:00
parent e37b055f1d
commit 9b4cb6a072
2 changed files with 14 additions and 0 deletions

View file

@ -14,6 +14,10 @@
public const string CmdSourceOptionDescription = "Specifies a NuGet package source to use during the restore.";
public const string CmdRuntimeOption = "RUNTIME_IDENTIFIER";
public const string CmdRuntimeOptionDescription = "Target runtime to restore packages for.";
public const string CmdPackagesOption = "PACKAGES_DIRECTORY";
public const string CmdPackagesOptionDescription = "Directory to install packages in.";

View file

@ -35,6 +35,11 @@ namespace Microsoft.DotNet.Tools.Restore
LocalizableStrings.CmdSourceOptionDescription,
CommandOptionType.MultipleValue);
var runtimeOption = cmd.Option(
$"-r|--runtime <{LocalizableStrings.CmdRuntimeOption}>",
LocalizableStrings.CmdRuntimeOptionDescription,
CommandOptionType.MultipleValue);
var packagesOption = cmd.Option(
$"--packages <{LocalizableStrings.CmdPackagesOption}>",
LocalizableStrings.CmdPackagesOptionDescription,
@ -81,6 +86,11 @@ namespace Microsoft.DotNet.Tools.Restore
msbuildArgs.Add($"/p:RestoreSources={string.Join("%3B", sourceOption.Values)}");
}
if (runtimeOption.HasValue())
{
msbuildArgs.Add($"/p:RuntimeIdentifiers={string.Join("%3B", runtimeOption.Values)}");
}
if (packagesOption.HasValue())
{
msbuildArgs.Add($"/p:RestorePackagesPath={packagesOption.Value()}");