From 808ff7c6dbec232062f8f835a0061e0b99443cd9 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Fri, 2 Jun 2017 17:04:57 -0700 Subject: [PATCH] Add restore force option --- .../commands/dotnet-restore/LocalizableStrings.cs | 3 +++ src/dotnet/commands/dotnet-restore/Program.cs | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/dotnet/commands/dotnet-restore/LocalizableStrings.cs b/src/dotnet/commands/dotnet-restore/LocalizableStrings.cs index ac3d8b115..c06b6b6b3 100644 --- a/src/dotnet/commands/dotnet-restore/LocalizableStrings.cs +++ b/src/dotnet/commands/dotnet-restore/LocalizableStrings.cs @@ -33,5 +33,8 @@ public const string CmdIgnoreFailedSourcesOptionDescription = "Treat package source failures as warnings."; public const string CmdNoDependenciesOptionDescription = "Set this flag to ignore project to project references and only restore the root project"; + + public const string CmdForceRestoreOptionDescription = "Set this flag to force all dependencies to be resolved even if the last restore was successful. This is equivalent to deleting project.assets.json."; + } } diff --git a/src/dotnet/commands/dotnet-restore/Program.cs b/src/dotnet/commands/dotnet-restore/Program.cs index fca6f25b8..53e138fb8 100644 --- a/src/dotnet/commands/dotnet-restore/Program.cs +++ b/src/dotnet/commands/dotnet-restore/Program.cs @@ -69,6 +69,11 @@ namespace Microsoft.DotNet.Tools.Restore "--no-dependencies", LocalizableStrings.CmdNoDependenciesOptionDescription, CommandOptionType.NoValue); + + var forceOption = cmd.Option( + $"-f|--force", + LocalizableStrings.CmdForceRestoreOptionDescription, + CommandOptionType.NoValue); CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(cmd); @@ -120,6 +125,11 @@ namespace Microsoft.DotNet.Tools.Restore { msbuildArgs.Add($"/p:RestoreRecursive=false"); } + + if(forceOption.HasValue()) + { + msbuildArgs.Add($"/p:RestoreForce=true"); + } if (verbosityOption.HasValue()) {