diff --git a/src/Cake.Common.Tests/Unit/Tools/DotNetCore/Restore/DotNetCoreRestorerTests.cs b/src/Cake.Common.Tests/Unit/Tools/DotNetCore/Restore/DotNetCoreRestorerTests.cs
index 449be7bf79..2dc4f22473 100644
--- a/src/Cake.Common.Tests/Unit/Tools/DotNetCore/Restore/DotNetCoreRestorerTests.cs
+++ b/src/Cake.Common.Tests/Unit/Tools/DotNetCore/Restore/DotNetCoreRestorerTests.cs
@@ -145,6 +145,77 @@ public void Should_Add_Host_Arguments()
// Then
Assert.Equal("--diagnostics restore", result.Args);
}
+
+ [Fact]
+ public void Should_Add_Interactive()
+ {
+ // Given
+ var fixture = new DotNetCoreRestorerFixture();
+ fixture.Settings.Interactive = true;
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ Assert.Equal($@"restore --interactive", result.Args);
+ }
+
+ [Fact]
+ public void Should_Add_UseLockFile()
+ {
+ // Given
+ var fixture = new DotNetCoreRestorerFixture();
+ fixture.Settings.UseLockFile = true;
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ Assert.Equal($@"restore --use-lock-file", result.Args);
+ }
+
+ [Fact]
+ public void Should_Add_LockedMode()
+ {
+ // Given
+ var fixture = new DotNetCoreRestorerFixture();
+ fixture.Settings.LockedMode = true;
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ Assert.Equal($@"restore --locked-mode", result.Args);
+ }
+
+ [Fact]
+ public void Should_Add_LockFilePath()
+ {
+ // Given
+ var fixture = new DotNetCoreRestorerFixture();
+ const string lockfile = @"mypackages.lock.json";
+ fixture.Settings.LockFilePath = lockfile;
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ Assert.Equal($@"restore --lock-file-path ""/Working/{lockfile}""", result.Args);
+ }
+
+ [Fact]
+ public void Should_Add_ForceEvaluate()
+ {
+ // Given
+ var fixture = new DotNetCoreRestorerFixture();
+ fixture.Settings.ForceEvaluate = true;
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ Assert.Equal($@"restore --force-evaluate", result.Args);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/Cake.Common/Tools/DotNetCore/Restore/DotNetCoreRestoreSettings.cs b/src/Cake.Common/Tools/DotNetCore/Restore/DotNetCoreRestoreSettings.cs
index 2c069c8401..5f0b4d3be9 100644
--- a/src/Cake.Common/Tools/DotNetCore/Restore/DotNetCoreRestoreSettings.cs
+++ b/src/Cake.Common/Tools/DotNetCore/Restore/DotNetCoreRestoreSettings.cs
@@ -61,6 +61,53 @@ public sealed class DotNetCoreRestoreSettings : DotNetCoreSettings
///
public bool Force { get; set; }
+ ///
+ /// Gets or sets a value indicating whether to stop and wait for user input or action (for example to complete authentication)
+ ///
+ ///
+ /// Supported by .NET SDK version 2.1.400 and above
+ ///
+ public bool Interactive { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to enable project lock file to be generated and used with restore
+ ///
+ ///
+ /// Supported by .NET SDK version 2.1.500 and above
+ ///
+ public bool UseLockFile { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to not allow updating project lock file
+ ///
+ ///
+ /// When set to true, restore will fail if the lock file is out of sync.
+ /// Useful for CI builds when you do not want the build to continue if the package closure has changed than what is present in the lock file.
+ ///
+ /// Supported by .NET SDK version 2.1.500 and above
+ ///
+ ///
+ public bool LockedMode { get; set; }
+
+ ///
+ /// Gets or sets a value indicating output location where project lock file is written.
+ ///
+ ///
+ /// If not set, 'dotnet restore' defaults to 'PROJECT_ROOT\packages.lock.json'
+ ///
+ /// Supported by .NET SDK version 2.1.500 and above
+ ///
+ ///
+ public FilePath LockFilePath { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to force restore to reevaluate all dependencies even if a lock file already exists
+ ///
+ ///
+ /// Supported by .NET SDK version 2.1.500 and above
+ ///
+ public bool ForceEvaluate { get; set; }
+
///
/// Gets or sets additional arguments to be passed to MSBuild.
///
diff --git a/src/Cake.Common/Tools/DotNetCore/Restore/DotNetCoreRestorer.cs b/src/Cake.Common/Tools/DotNetCore/Restore/DotNetCoreRestorer.cs
index f87f7de51d..abc49f0684 100644
--- a/src/Cake.Common/Tools/DotNetCore/Restore/DotNetCoreRestorer.cs
+++ b/src/Cake.Common/Tools/DotNetCore/Restore/DotNetCoreRestorer.cs
@@ -126,6 +126,36 @@ private ProcessArgumentBuilder GetArguments(string root, DotNetCoreRestoreSettin
builder.Append("--force");
}
+ // Interactive
+ if (settings.Interactive)
+ {
+ builder.Append("--interactive");
+ }
+
+ // Use lock file
+ if (settings.UseLockFile)
+ {
+ builder.Append("--use-lock-file");
+ }
+
+ // Locked mode
+ if (settings.LockedMode)
+ {
+ builder.Append("--locked-mode");
+ }
+
+ // Lock file path
+ if (settings.LockFilePath != null)
+ {
+ builder.AppendSwitchQuoted("--lock-file-path", " ", settings.LockFilePath.MakeAbsolute(_environment).FullPath);
+ }
+
+ // force evaluate
+ if (settings.ForceEvaluate)
+ {
+ builder.Append("--force-evaluate");
+ }
+
if (settings.MSBuildSettings != null)
{
builder.AppendMSBuildSettings(settings.MSBuildSettings, _environment);