Skip to content

feat(jobs): add MsBuildProperty for escaped MSBuild properties#3055

Merged
timcassell merged 1 commit intodotnet:masterfrom
fuguiKz:jobs/msbuildproperty-escape
Mar 22, 2026
Merged

feat(jobs): add MsBuildProperty for escaped MSBuild properties#3055
timcassell merged 1 commit intodotnet:masterfrom
fuguiKz:jobs/msbuildproperty-escape

Conversation

@fuguiKz
Copy link
Contributor

@fuguiKz fuguiKz commented Mar 21, 2026

Fixes #2719.

What

  • Add opt-in MSBuild special character escaping via new MsBuildArgument(value, escapeSpecialCharacters: true).
  • Add MsBuildProperty : MsBuildArgument for /p:name=value (joins multiple values with ; and escapes automatically).
  • Keep reports readable by showing the unescaped value via ToString() when escaping is enabled.
  • Add unit + integration coverage for semicolon-separated values.
  • Docs: troubleshooting guide now mentions MsBuildProperty.

Why

MSBuild treats ; as a property separator in /p: so values like DefineConstants=TEST1;TEST2 must be escaped (eg %3B) to work reliably.

Verification

  • dotnet test tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj -c Release -f net8.0 --filter FullyQualifiedName~MsBuildArgumentTests
  • dotnet test tests/BenchmarkDotNet.IntegrationTests.ManualRunning/BenchmarkDotNet.IntegrationTests.ManualRunning.csproj -c Release -f net8.0 --filter FullyQualifiedName~MsBuildArgumentTests

Context

This follows the combined direction discussed in #2730 / #2732 (opt-in escaping + a dedicated property type).

Copy link
Collaborator

@timcassell timcassell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fuguiKz

@timcassell timcassell merged commit aaef1ac into dotnet:master Mar 22, 2026
11 checks passed
@timcassell timcassell added this to the v0.16.0 milestone Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add MsBuildArgument supports for MSBuild special characters

2 participants