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()) {