cake-build / cake-build/cake

MSBuild properties are incorrectly formatted

Open
#4,297 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched [issues](https://github.com/cake-build/cake/issues) to ensure it has not already been reported

### Cake runner

Cake Frosting

### Cake version

4.0.0

### Operating system

Linux

### Operating system architecture

64-Bit

### CI Server

_No response_

### What are you seeing?

MSBuild arguments are rendered like so:
```
/property:DefineConstants=foo;bar;baz
```

Which leads to an error:
![image](https://github.com/cake-build/cake/assets/28568841/c531b3c7-d994-466d-a996-3bc3fa1b40c4)

### What is expected?

MSBuild properties should be specified in the correct format. For example:

```
/property:DefineConstants=foo;DefineConstants=bar;DefineConstants=baz
```

### Steps to Reproduce

Create a task with the following `Run` implementation:

```cs
var buildSettings = new DotNetBuildSettings {
Configuration = "Release",

MSBuildSettings = new() {
Properties = {
{"DefineConstants", ["foo", "bar", "baz"] },
},
},
};

context.DotNetBuild(context.RootDirectory, buildSettings);
```

Ensure that `context.RootDirectory` is defined.

Run the task.

### Notes

Related: #1852
Of note, I believe [this comment](https://github.com/cake-build/cake/issues/1852#issuecomment-333508083) is incorrect.
Perhaps `WithProperty("DefineConstants", "A=a", "B=b");` should instead generate:
```
/p:DefineConstants=A=a;DefineConstants=B=b
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing how DotNetBuildSettings and MSBuildSettings.Properties are rendered into MSBuild arguments, then compare the behavior with the discussion in related issue #1852. Reproduce the issue using the provided Cake Frosting task on Linux. Done means each value produces the expected repeated DefineConstants property format instead of one semicolon-joined value.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.