diff --git a/src/Cake.Common/Tools/DotNet/MSBuild/MSBuildArgumentBuilderExtensions.cs b/src/Cake.Common/Tools/DotNet/MSBuild/MSBuildArgumentBuilderExtensions.cs index 68156d416b..cdd25b132b 100644 --- a/src/Cake.Common/Tools/DotNet/MSBuild/MSBuildArgumentBuilderExtensions.cs +++ b/src/Cake.Common/Tools/DotNet/MSBuild/MSBuildArgumentBuilderExtensions.cs @@ -55,11 +55,6 @@ public static void AppendMSBuildSettings(this ProcessArgumentBuilder builder, Do // Got any properties? foreach (var property in settings.Properties) { - if (property.Value == null || property.Value.All(string.IsNullOrWhiteSpace)) - { - throw new ArgumentException("A property must have at least one non-empty value", nameof(settings.Properties)); - } - msBuilder.AppendMSBuildSwitch("property", $"{property.Key}={property.BuildMSBuildPropertyParameterString()}"); } diff --git a/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake b/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake index 68b058a6d6..674d342a4d 100644 --- a/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake +++ b/tests/integration/Cake.Common/Tools/DotNet/DotNetAliases.cake @@ -223,6 +223,26 @@ Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetMSBuild") Assert.True(System.IO.File.Exists(assembly.FullPath)); }); +Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetMSBuildEmptyParametersAllowed") + .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases.DotNetClean") + .Does(() => +{ + // Given + var path = Paths.Temp.Combine("./Cake.Common/Tools/DotNet"); + var project = path.CombineWithFilePath("hwapp/hwapp.csproj"); + var assembly = path.CombineWithFilePath("hwapp/bin/Debug/net7.0/hwapp.dll"); + + // When + DotNetMSBuild(project.FullPath, new DotNetBuildSettings() { + MSBuildSettings = new DotNetMSBuildSettings(){ + } + .WithProperty("APropertyIWantTobeBlank", "") + }); + + // Then + Assert.True(true); +}); + Task("Cake.Common.Tools.DotNet.DotNetAliases.DotNetTest.Fail") .IsDependentOn("Cake.Common.Tools.DotNet.DotNetAliases.DotNetTest") .Does(() =>