Skip to content

Cannot specify empty properties when using DotNetBuild #4158

@Zulu-Inuoe

Description

@Zulu-Inuoe

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake .NET Tool

Cake version

3.0.0

Operating system

Windows

Operating system architecture

64-Bit

CI Server

Jenkins

What are you seeing?

And I receive the error that A property must have at least one non-empty value

In my build.cake file I have the following:

DotNetBuild("./My.sln", new DotNetBuildSettings() {
    MSBuildSettings = new DotNetMSBuildSettings() {
    }
    .WithProperty("PackageCertificateThumbprint", "")
});

Looking at the source
https://github.com/cake-build/cake/blob/b55239f748f921edc303d644839183e9727e00a4/src/Cake.Common/Tools/DotNet/MSBuild/MSBuildArgumentBuilderExtensions.cs#LL58C1-L61C18

this is presumably intentional.
However, setting this property as empty is in fact desired. see
https://learn.microsoft.com/en-us/windows/uwp/packaging/auto-build-package-uwp-apps

Specifically:

The PackageCertificateThumbprint argument is intentionally set to an empty string as a precaution. If the thumbprint is set in the project but does not match the signing certificate, the build will fail with the error: Certificate does not match supplied signing thumbprint.

Is there any reason why we cannot set empty properties? Note that this problem is not there when using the MSBuild tool, rather than DotNetBuild

Seems like an easy fix but it's odd this check is in there to begin with

What is expected?

That I build and end up with /p:PackageCertificateThumbprint ""

Steps to Reproduce

DotNetBuild("./My.sln", new DotNetBuildSettings() {
    MSBuildSettings = new DotNetMSBuildSettings() {
    }
    .WithProperty("PackageCertificateThumbprint", "")
});

Output log

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions