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:
parent
e37b055f1d
commit
9b4cb6a072
2 changed files with 14 additions and 0 deletions
|
@ -14,6 +14,10 @@
|
||||||
|
|
||||||
public const string CmdSourceOptionDescription = "Specifies a NuGet package source to use during the restore.";
|
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 CmdPackagesOption = "PACKAGES_DIRECTORY";
|
||||||
|
|
||||||
public const string CmdPackagesOptionDescription = "Directory to install packages in.";
|
public const string CmdPackagesOptionDescription = "Directory to install packages in.";
|
||||||
|
|
|
@ -35,6 +35,11 @@ namespace Microsoft.DotNet.Tools.Restore
|
||||||
LocalizableStrings.CmdSourceOptionDescription,
|
LocalizableStrings.CmdSourceOptionDescription,
|
||||||
CommandOptionType.MultipleValue);
|
CommandOptionType.MultipleValue);
|
||||||
|
|
||||||
|
var runtimeOption = cmd.Option(
|
||||||
|
$"-r|--runtime <{LocalizableStrings.CmdRuntimeOption}>",
|
||||||
|
LocalizableStrings.CmdRuntimeOptionDescription,
|
||||||
|
CommandOptionType.MultipleValue);
|
||||||
|
|
||||||
var packagesOption = cmd.Option(
|
var packagesOption = cmd.Option(
|
||||||
$"--packages <{LocalizableStrings.CmdPackagesOption}>",
|
$"--packages <{LocalizableStrings.CmdPackagesOption}>",
|
||||||
LocalizableStrings.CmdPackagesOptionDescription,
|
LocalizableStrings.CmdPackagesOptionDescription,
|
||||||
|
@ -81,6 +86,11 @@ namespace Microsoft.DotNet.Tools.Restore
|
||||||
msbuildArgs.Add($"/p:RestoreSources={string.Join("%3B", sourceOption.Values)}");
|
msbuildArgs.Add($"/p:RestoreSources={string.Join("%3B", sourceOption.Values)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (runtimeOption.HasValue())
|
||||||
|
{
|
||||||
|
msbuildArgs.Add($"/p:RuntimeIdentifiers={string.Join("%3B", runtimeOption.Values)}");
|
||||||
|
}
|
||||||
|
|
||||||
if (packagesOption.HasValue())
|
if (packagesOption.HasValue())
|
||||||
{
|
{
|
||||||
msbuildArgs.Add($"/p:RestorePackagesPath={packagesOption.Value()}");
|
msbuildArgs.Add($"/p:RestorePackagesPath={packagesOption.Value()}");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue