diff --git a/src/Cake.Common.Tests/Unit/Tools/NuGet/Install/NuGetInstallerSettingsTests.cs b/src/Cake.Common.Tests/Unit/Tools/NuGet/Install/NuGetInstallerSettingsTests.cs
index 811543ca8e..c9df1fffc3 100644
--- a/src/Cake.Common.Tests/Unit/Tools/NuGet/Install/NuGetInstallerSettingsTests.cs
+++ b/src/Cake.Common.Tests/Unit/Tools/NuGet/Install/NuGetInstallerSettingsTests.cs
@@ -18,7 +18,19 @@ public void Should_Set_NoCache_To_False_By_Default()
var settings = new NuGetInstallSettings();
// Then
+ #pragma warning disable CS0618
Assert.False(settings.NoCache);
+ #pragma warning restore CS0618
+ }
+
+ [Fact]
+ public void Should_Set_NoHttpCache_To_False_By_Default()
+ {
+ // Given, When
+ var settings = new NuGetInstallSettings();
+
+ // Then
+ Assert.False(settings.NoHttpCache);
}
[Fact]
diff --git a/src/Cake.Common.Tests/Unit/Tools/NuGet/Install/NuGetInstallerTests.cs b/src/Cake.Common.Tests/Unit/Tools/NuGet/Install/NuGetInstallerTests.cs
index bb55c6166f..6d4331c83e 100644
--- a/src/Cake.Common.Tests/Unit/Tools/NuGet/Install/NuGetInstallerTests.cs
+++ b/src/Cake.Common.Tests/Unit/Tools/NuGet/Install/NuGetInstallerTests.cs
@@ -191,7 +191,9 @@ public void Should_Add_NoCache_To_Arguments_If_True()
{
// Given
var fixture = new NuGetInstallerFixture();
+ #pragma warning disable CS0618
fixture.Settings.NoCache = true;
+ #pragma warning restore CS0618
// When
var result = fixture.Run();
@@ -200,6 +202,20 @@ public void Should_Add_NoCache_To_Arguments_If_True()
Assert.Equal("install \"Cake\" -NoCache -NonInteractive", result.Args);
}
+ [Fact]
+ public void Should_Add_NoHttpCache_To_Arguments_If_True()
+ {
+ // Given
+ var fixture = new NuGetInstallerFixture();
+ fixture.Settings.NoHttpCache = true;
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ Assert.Equal("install \"Cake\" -NoHttpCache -NonInteractive", result.Args);
+ }
+
[Fact]
public void Should_Add_DisableParallelProcessing_To_Arguments_If_Set()
{
@@ -460,7 +476,9 @@ public void Should_Add_NoCache_To_Arguments_If_True()
{
// Given
var fixture = new NuGetInstallerFromConfigFixture();
+ #pragma warning disable CS0618
fixture.Settings.NoCache = true;
+ #pragma warning restore CS0618
// When
var result = fixture.Run();
@@ -470,6 +488,21 @@ public void Should_Add_NoCache_To_Arguments_If_True()
"-NonInteractive", result.Args);
}
+ [Fact]
+ public void Should_Add_NoHttpCache_To_Arguments_If_True()
+ {
+ // Given
+ var fixture = new NuGetInstallerFromConfigFixture();
+ fixture.Settings.NoHttpCache = true;
+
+ // When
+ var result = fixture.Run();
+
+ // Then
+ Assert.Equal("install \"/Working/packages.config\" -NoHttpCache " +
+ "-NonInteractive", result.Args);
+ }
+
[Fact]
public void Should_Add_DisableParallelProcessing_To_Arguments_If_Set()
{
diff --git a/src/Cake.Common/Tools/NuGet/Install/NuGetInstallSettings.cs b/src/Cake.Common/Tools/NuGet/Install/NuGetInstallSettings.cs
index 48c372625c..4e86e47b0c 100644
--- a/src/Cake.Common/Tools/NuGet/Install/NuGetInstallSettings.cs
+++ b/src/Cake.Common/Tools/NuGet/Install/NuGetInstallSettings.cs
@@ -71,8 +71,17 @@ public sealed class NuGetInstallSettings : ToolSettings
///
/// true to not use the machine cache as the first package source; otherwise, false.
///
+ [System.Obsolete("NoCache is deprecated and has been renamed to NoHttpCache. Please use NoHttpCache instead.")]
public bool NoCache { get; set; }
+ ///
+ /// Gets or sets a value indicating whether or not use the HTTP cache and contact all configured package sources for live information.
+ ///
+ ///
+ /// true to not use the HTTP cache and contact package sources for live information; otherwise, false.
+ ///
+ public bool NoHttpCache { get; set; }
+
///
/// Gets or sets a value indicating whether to disable parallel processing of packages for this command.
/// Disable parallel processing of packages for this command.
diff --git a/src/Cake.Common/Tools/NuGet/Install/NuGetInstaller.cs b/src/Cake.Common/Tools/NuGet/Install/NuGetInstaller.cs
index c89b649fde..200253a7d5 100644
--- a/src/Cake.Common/Tools/NuGet/Install/NuGetInstaller.cs
+++ b/src/Cake.Common/Tools/NuGet/Install/NuGetInstaller.cs
@@ -136,10 +136,18 @@ private ProcessArgumentBuilder GetArguments(string packageId, NuGetInstallSettin
}
// No Cache?
+#pragma warning disable CS0618
if (settings.NoCache)
{
builder.Append("-NoCache");
}
+#pragma warning restore CS0618
+
+ // No Http Cache?
+ if (settings.NoHttpCache)
+ {
+ builder.Append("-NoHttpCache");
+ }
// Disable Parallel Processing?
if (settings.DisableParallelProcessing)