Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/BenchmarkDotNet/Jobs/Argument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ public MonoArgument(string value) : base(value)
/// example: new MsBuildArgument("/p:MyCustomSetting=123")
/// </summary>
[PublicAPI]

/// <summary>
/// A specialized MSBuild argument that sets a property using a quoted, semicolon-separated list of values.
/// </summary>
public class MsBuildProperty : MsBuildArgument
{
public MsBuildProperty(string key, params string[] values)
: base($"/p:{key}=\\\"{string.Join(";", values)}\\\"")
{
}


}
public class MsBuildArgument : Argument
{
public MsBuildArgument(string value) : base(value) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ public void ProcessIsBuiltWithCustomProperty(bool setCustomProperty)
CanExecute<PropertyDefine>(config);
}

[Fact]

public void MsBuildProperty_ShouldWrapMultipleValuesInQuotes()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move this test to BenchmarkDotNet.Tests project, and add a real integration test in BenchmarkDotNet.IntegrationTests project.

{
var arg = new MsBuildProperty("DefineConstants", "FOO", "BAR");
Assert.Equal("/p:DefineConstants=\"FOO;BAR\"", arg.TextRepresentation);
}
[Fact]
public void MultipleProcessesAreBuiltWithCorrectProperties()
{
Expand Down