diff --git a/resources/MSBuildImports/15.0/SolutionFile/ImportAfter/Microsoft.NuGet.ImportAfter.targets b/resources/MSBuildImports/15.0/SolutionFile/ImportAfter/Microsoft.NuGet.ImportAfter.targets new file mode 100644 index 000000000..433922aac --- /dev/null +++ b/resources/MSBuildImports/15.0/SolutionFile/ImportAfter/Microsoft.NuGet.ImportAfter.targets @@ -0,0 +1,18 @@ + + + + + $(MSBuildExtensionsPath)\NuGet.targets + + + diff --git a/src/dotnet/commands/dotnet-restore3/Program.cs b/src/dotnet/commands/dotnet-restore3/Program.cs index 7a8d5f0af..1a753dc7f 100644 --- a/src/dotnet/commands/dotnet-restore3/Program.cs +++ b/src/dotnet/commands/dotnet-restore3/Program.cs @@ -60,6 +60,12 @@ namespace Microsoft.DotNet.Tools.Restore3 "Treat package source failures as warnings.", CommandOptionType.NoValue); + // Use a boolean argument instead of a switch to match nuget.exe + var recursive = cmd.Option( + "--recursive", + "Restore all dependency projects.", + CommandOptionType.BoolValue); + cmd.OnExecute(() => { var msbuildArgs = new List() @@ -69,7 +75,7 @@ namespace Microsoft.DotNet.Tools.Restore3 if (sourceOption.HasValue()) { - msbuildArgs.Add($"/p:RestoreSources={string.Join(";", sourceOption.Values)}"); + msbuildArgs.Add($"/p:RestoreSources={string.Join("%3B", sourceOption.Values)}"); } if (packagesOption.HasValue()) @@ -97,6 +103,13 @@ namespace Microsoft.DotNet.Tools.Restore3 msbuildArgs.Add($"/p:RestoreIgnoreFailedSources=true"); } + // By default restore is recursive, if set to false turn it off. + // If the argument is not present use the default behavior. + if (recursive.BoolValue == false) + { + msbuildArgs.Add($"/p:RestoreRecursive=false"); + } + // Add in arguments msbuildArgs.AddRange(argRoot.Values);