Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot specify empty properties when using DotNetBuild #4158

Open
2 tasks done
Zulu-Inuoe opened this issue May 24, 2023 · 2 comments · May be fixed by #4165
Open
2 tasks done

Cannot specify empty properties when using DotNetBuild #4158

Zulu-Inuoe opened this issue May 24, 2023 · 2 comments · May be fixed by #4165
Assignees

Comments

@Zulu-Inuoe
Copy link

Zulu-Inuoe commented May 24, 2023

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

@augustoproiete
Copy link
Member

Thanks @Zulu-Inuoe for reporting. It makes sense to allow for empty string values set explicitly. Let us know if you'll submit a PR or if we should leave this up-for-grabs

@Zulu-Inuoe
Copy link
Author

Hey @augustoproiete sorry for the delay - Yes I will take a look at this while I can and open up a PR either today or tomorrow. But I won't complain if somebody else gets it done before I do!

Zulu-Inuoe added a commit to Zulu-Inuoe/cake that referenced this issue Jun 4, 2023
@Zulu-Inuoe Zulu-Inuoe linked a pull request Jun 4, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants