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

fix regression in --property forwarding with an invalid argument #43004

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/Cli/dotnet/OptionForwardingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static ForwardedOption<string[]> ForwardAsProperty(this ForwardedOption<s
.SetForwardingFunction((optionVals) =>
optionVals
.SelectMany(Utils.MSBuildPropertyParser.ParseProperties)
.Select(keyValue => keyValue.value == "" ? $"{option.Name}:{keyValue.key}" : $"{option.Name}:{keyValue.key}={keyValue.value}")
.Select(keyValue => $"{option.Name}:{keyValue.key}={keyValue.value}")
);

public static CliOption<T> ForwardAsMany<T>(this ForwardedOption<T> option, Func<T, IEnumerable<string>> format) => option.SetForwardingFunction(format);
Expand Down
2 changes: 0 additions & 2 deletions test/dotnet.Tests/dotnet-msbuild/GivenDotnetRunInvocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public GivenDotnetRunInvocation(ITestOutputHelper log)
[InlineData(new string[] { "-p", "prop1=true", "-p", "prop2=false" }, new string[] { "--property:prop1=true", "--property:prop2=false" })]
[InlineData(new string[] { "-p:prop1=true;prop2=false" }, new string[] { "--property:prop1=true", "--property:prop2=false" })]
[InlineData(new string[] { "-p", "MyProject.csproj", "-p:prop1=true" }, new string[] { "--property:prop1=true" })]
// The longhand --property option should never be treated as a project
[InlineData(new string[] { "--property", "MyProject.csproj", "-p:prop1=true" }, new string[] { "--property:MyProject.csproj", "--property:prop1=true" })]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this test could be moved so that this is a different failure, like "you said --property but didn't specify one"?

[InlineData(new string[] { "--disable-build-servers" }, new string[] { "--property:UseRazorBuildServer=false", "--property:UseSharedCompilation=false", "/nodeReuse:false" })]
public void MsbuildInvocationIsCorrect(string[] args, string[] expectedArgs)
{
Expand Down
Loading