From 98dd811aa863f0921cd3275ff444e89003f6b045 Mon Sep 17 00:00:00 2001 From: Peter Huene Date: Thu, 31 May 2018 21:20:25 -0700 Subject: [PATCH] Revert "Fix MSBuild invocation to quote property option values." This reverts commit f9b939fe8996210666f4740d16e997081023bb23. That fix caused a regression that prevented a single `/property` option to define multiple properties using the `/property:First=foo;Second=bar` syntax. Users that want literal semicolons in the property values should use escaped quotes around the property value, e.g. `/property:Prop='"foo;bar;baz"'`. Fixes #9369. --- .../ProjectPrintsNoWarn.csproj | 12 ----- .../ArgumentEscaper.cs | 20 ++++++--- .../MSBuildForwardingAppWithoutLogging.cs | 44 ++++++------------- src/dotnet/commands/dotnet-test/Program.cs | 13 ++++++ .../GivenDotnetBuildInvocation.cs | 28 ++++++------ .../GivenDotnetCleanInvocation.cs | 12 ++--- .../GivenDotnetMSBuildBuildsProjects.cs | 20 --------- .../GivenDotnetPackInvocation.cs | 20 ++++----- .../GivenDotnetPublishInvocation.cs | 22 +++++----- .../GivenDotnetRestoreInvocation.cs | 24 +++++----- .../GivenDotnetStoreInvocation.cs | 12 ++--- 11 files changed, 99 insertions(+), 128 deletions(-) delete mode 100644 TestAssets/TestProjects/ProjectPrintsNoWarn/ProjectPrintsNoWarn.csproj diff --git a/TestAssets/TestProjects/ProjectPrintsNoWarn/ProjectPrintsNoWarn.csproj b/TestAssets/TestProjects/ProjectPrintsNoWarn/ProjectPrintsNoWarn.csproj deleted file mode 100644 index 4e83f2fad..000000000 --- a/TestAssets/TestProjects/ProjectPrintsNoWarn/ProjectPrintsNoWarn.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - library - netcoreapp2.0 - - - - - - - diff --git a/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs b/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs index c87268c00..afaa58d48 100644 --- a/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs +++ b/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs @@ -59,10 +59,14 @@ namespace Microsoft.DotNet.Cli.Utils /// private static IEnumerable EscapeArgArray(IEnumerable args) { + var escapedArgs = new List(); + foreach (var arg in args) { - yield return EscapeSingleArg(arg); + escapedArgs.Add(EscapeSingleArg(arg)); } + + return escapedArgs; } /// @@ -75,19 +79,23 @@ namespace Microsoft.DotNet.Cli.Utils /// /// /// - private static IEnumerable EscapeArgArrayForCmd(IEnumerable args) + private static IEnumerable EscapeArgArrayForCmd(IEnumerable arguments) { - foreach (var arg in args) + var escapedArgs = new List(); + + foreach (var arg in arguments) { - yield return EscapeArgForCmd(arg); + escapedArgs.Add(EscapeArgForCmd(arg)); } + + return escapedArgs; } - public static string EscapeSingleArg(string arg, bool forceQuotes = false) + public static string EscapeSingleArg(string arg) { var sb = new StringBuilder(); - var needsQuotes = forceQuotes || ShouldSurroundWithQuotes(arg); + var needsQuotes = ShouldSurroundWithQuotes(arg); var isQuoted = needsQuotes || IsSurroundedWithQuotes(arg); if (needsQuotes) sb.Append("\""); diff --git a/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs b/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs index cee835aa0..d46eb52f2 100644 --- a/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs +++ b/src/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs @@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Cli.Utils { _forwardingApp = new ForwardingAppImplementation( msbuildPath ?? GetMSBuildExePath(), - _msbuildRequiredParameters.Concat(argsToForward.Select(QuotePropertyValue)), + _msbuildRequiredParameters.Concat(argsToForward.Select(Escape)), environmentVariables: _msbuildRequiredEnvironmentVariables); } @@ -49,6 +49,13 @@ namespace Microsoft.DotNet.Cli.Utils return GetProcessStartInfo().Execute(); } + private static string Escape(string arg) => + // this is a workaround for https://github.com/Microsoft/msbuild/issues/1622 + IsRestoreSources(arg) ? + arg.Replace(";", "%3B") + .Replace("://", ":%2F%2F") : + arg; + private static string GetMSBuildExePath() { return Path.Combine( @@ -75,37 +82,12 @@ namespace Microsoft.DotNet.Cli.Utils return new Muxer().MuxerPath; } - private static bool IsPropertyArgument(string arg) + private static bool IsRestoreSources(string arg) { - return - arg.StartsWith("/p:", StringComparison.OrdinalIgnoreCase) || - arg.StartsWith("/property:", StringComparison.OrdinalIgnoreCase) || - arg.StartsWith("-p:", StringComparison.OrdinalIgnoreCase) || - arg.StartsWith("-property:", StringComparison.OrdinalIgnoreCase); - } - - private static string QuotePropertyValue(string arg) - { - if (!IsPropertyArgument(arg)) - { - return arg; - } - - var parts = arg.Split(new[] { '=' }, 2); - if (parts.Length != 2) - { - return arg; - } - - // Escaping `://` is a workaround for https://github.com/Microsoft/msbuild/issues/1622 - // The issue is that MSBuild is collapsing multiple slashes to a single slash due to a bad regex. - var value = parts[1].Replace("://", ":%2f%2f"); - if (ArgumentEscaper.IsSurroundedWithQuotes(value)) - { - return $"{parts[0]}={value}"; - } - - return $"{parts[0]}={ArgumentEscaper.EscapeSingleArg(value, forceQuotes: true)}"; + return arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase) || + arg.StartsWith("/property:RestoreSources=", StringComparison.OrdinalIgnoreCase) || + arg.StartsWith("-p:RestoreSources=", StringComparison.OrdinalIgnoreCase) || + arg.StartsWith("-property:RestoreSources=", StringComparison.OrdinalIgnoreCase); } } } diff --git a/src/dotnet/commands/dotnet-test/Program.cs b/src/dotnet/commands/dotnet-test/Program.cs index 320aaba02..ac7062f03 100644 --- a/src/dotnet/commands/dotnet-test/Program.cs +++ b/src/dotnet/commands/dotnet-test/Program.cs @@ -124,6 +124,19 @@ namespace Microsoft.DotNet.Tools.Test return arg; } + private static string[] GetSemiColonEscapedArgs(List args) + { + int counter = 0; + string[] array = new string[args.Count]; + + foreach (string arg in args) + { + array[counter++] = GetSemiColonEscapedString(arg); + } + + return array; + } + private static void UpdateRunSettingsArgumentsText() { DefaultHelpViewText.Synopsis.AdditionalArguments = " [[--] ...]]"; diff --git a/test/dotnet-msbuild.Tests/GivenDotnetBuildInvocation.cs b/test/dotnet-msbuild.Tests/GivenDotnetBuildInvocation.cs index 022a2b78c..3a4821f5a 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetBuildInvocation.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetBuildInvocation.cs @@ -13,21 +13,21 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests [Theory] [InlineData(new string[] { }, "-target:Build")] - [InlineData(new string[] { "-o", "foo" }, @"-target:Build -property:OutputPath=\""foo\""")] - [InlineData(new string[] { "-property:Verbosity=diag" }, @"-target:Build -property:Verbosity=\""diag\""")] - [InlineData(new string[] { "--output", "foo" }, @"-target:Build -property:OutputPath=\""foo\""")] - [InlineData(new string[] { "-o", "foo1 foo2" }, @"-target:Build ""-property:OutputPath=\""foo1 foo2\""""")] + [InlineData(new string[] { "-o", "foo" }, "-target:Build -property:OutputPath=foo")] + [InlineData(new string[] { "-property:Verbosity=diag" }, "-target:Build -property:Verbosity=diag")] + [InlineData(new string[] { "--output", "foo" }, "-target:Build -property:OutputPath=foo")] + [InlineData(new string[] { "-o", "foo1 foo2" }, "-target:Build \"-property:OutputPath=foo1 foo2\"")] [InlineData(new string[] { "--no-incremental" }, "-target:Rebuild")] - [InlineData(new string[] { "-r", "rid" }, @"-target:Build -property:RuntimeIdentifier=\""rid\""")] - [InlineData(new string[] { "--runtime", "rid" }, @"-target:Build -property:RuntimeIdentifier=\""rid\""")] - [InlineData(new string[] { "-c", "config" }, @"-target:Build -property:Configuration=\""config\""")] - [InlineData(new string[] { "--configuration", "config" }, @"-target:Build -property:Configuration=\""config\""")] - [InlineData(new string[] { "--version-suffix", "mysuffix" }, @"-target:Build -property:VersionSuffix=\""mysuffix\""")] - [InlineData(new string[] { "--no-dependencies" }, @"-target:Build -property:BuildProjectReferences=\""false\""")] + [InlineData(new string[] { "-r", "rid" }, "-target:Build -property:RuntimeIdentifier=rid")] + [InlineData(new string[] { "--runtime", "rid" }, "-target:Build -property:RuntimeIdentifier=rid")] + [InlineData(new string[] { "-c", "config" }, "-target:Build -property:Configuration=config")] + [InlineData(new string[] { "--configuration", "config" }, "-target:Build -property:Configuration=config")] + [InlineData(new string[] { "--version-suffix", "mysuffix" }, "-target:Build -property:VersionSuffix=mysuffix")] + [InlineData(new string[] { "--no-dependencies" }, "-target:Build -property:BuildProjectReferences=false")] [InlineData(new string[] { "-v", "diag" }, "-target:Build -verbosity:diag")] [InlineData(new string[] { "--verbosity", "diag" }, "-target:Build -verbosity:diag")] [InlineData(new string[] { "--no-incremental", "-o", "myoutput", "-r", "myruntime", "-v", "diag", "/ArbitrarySwitchForMSBuild" }, - @"-target:Rebuild -property:OutputPath=\""myoutput\"" -property:RuntimeIdentifier=\""myruntime\"" -verbosity:diag /ArbitrarySwitchForMSBuild")] + "-target:Rebuild -property:OutputPath=myoutput -property:RuntimeIdentifier=myruntime -verbosity:diag /ArbitrarySwitchForMSBuild")] public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) { expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}"); @@ -43,10 +43,10 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests } [Theory] - [InlineData(new string[] { "-f", "tfm" }, "-target:Restore", @"-target:Build -property:TargetFramework=\""tfm\""")] + [InlineData(new string[] { "-f", "tfm" }, "-target:Restore", "-target:Build -property:TargetFramework=tfm")] [InlineData(new string[] { "-o", "myoutput", "-f", "tfm", "-v", "diag", "/ArbitrarySwitchForMSBuild" }, - @"-target:Restore -property:OutputPath=\""myoutput\"" -verbosity:diag /ArbitrarySwitchForMSBuild", - @"-target:Build -property:OutputPath=\""myoutput\"" -property:TargetFramework=\""tfm\"" -verbosity:diag /ArbitrarySwitchForMSBuild")] + "-target:Restore -property:OutputPath=myoutput -verbosity:diag /ArbitrarySwitchForMSBuild", + "-target:Build -property:OutputPath=myoutput -property:TargetFramework=tfm -verbosity:diag /ArbitrarySwitchForMSBuild")] public void MsbuildInvocationIsCorrectForSeparateRestore( string[] args, string expectedAdditionalArgsForRestore, diff --git a/test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs b/test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs index 9f9ced642..4c7d89890 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetCleanInvocation.cs @@ -22,12 +22,12 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests [Theory] [InlineData(new string[] { }, "")] - [InlineData(new string[] { "-o", "" }, @"-property:OutputPath=\""\""")] - [InlineData(new string[] { "--output", "" }, @"-property:OutputPath=\""\""")] - [InlineData(new string[] { "-f", "" }, @"-property:TargetFramework=\""\""")] - [InlineData(new string[] { "--framework", "" }, @"-property:TargetFramework=\""\""")] - [InlineData(new string[] { "-c", "" }, @"-property:Configuration=\""\""")] - [InlineData(new string[] { "--configuration", "" }, @"-property:Configuration=\""\""")] + [InlineData(new string[] { "-o", "" }, "-property:OutputPath=")] + [InlineData(new string[] { "--output", "" }, "-property:OutputPath=")] + [InlineData(new string[] { "-f", "" }, "-property:TargetFramework=")] + [InlineData(new string[] { "--framework", "" }, "-property:TargetFramework=")] + [InlineData(new string[] { "-c", "" }, "-property:Configuration=")] + [InlineData(new string[] { "--configuration", "" }, "-property:Configuration=")] [InlineData(new string[] { "-v", "diag" }, "-verbosity:diag")] [InlineData(new string[] { "--verbosity", "diag" }, "-verbosity:diag")] public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) diff --git a/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs b/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs index 1c0ea1047..b07fb937c 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetMSBuildBuildsProjects.cs @@ -159,26 +159,6 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests $"The MSBuild logger argument should not be specified when telemetry is disabled."); } - [Theory] - [InlineData("/p")] - [InlineData("/property")] - [InlineData("-p")] - [InlineData("-property")] - public void GivenAPropertyValueWithASemicolonItIsQuotedToMSBuild(string propertyOption) - { - var testInstance = TestAssets.Get("ProjectPrintsNoWarn") - .CreateInstance() - .WithSourceFiles(); - - new MSBuildCommand() - .WithWorkingDirectory(testInstance.Root) - .ExecuteWithCapturedOutput($@"/restore {propertyOption}:NoWarn=1234;5678;90\") - .Should() - .Pass() - .And - .HaveStdOutContaining(@"NoWarn => 1234;5678;90\"); - } - private string[] GetArgsForMSBuild(Func sentinelExists) { Telemetry.Telemetry telemetry; diff --git a/test/dotnet-msbuild.Tests/GivenDotnetPackInvocation.cs b/test/dotnet-msbuild.Tests/GivenDotnetPackInvocation.cs index 41fe24ee5..e0b766da5 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetPackInvocation.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetPackInvocation.cs @@ -16,16 +16,16 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests [Theory] [InlineData(new string[] { }, "")] - [InlineData(new string[] { "-o", "" }, @"-property:PackageOutputPath=\""\""")] - [InlineData(new string[] { "--output", "" }, @"-property:PackageOutputPath=\""\""")] - [InlineData(new string[] { "--no-build" }, @"-property:NoBuild=\""true\""")] - [InlineData(new string[] { "--include-symbols" }, @"-property:IncludeSymbols=\""true\""")] - [InlineData(new string[] { "--include-source" }, @"-property:IncludeSource=\""true\""")] - [InlineData(new string[] { "-c", "" }, @"-property:Configuration=\""\""")] - [InlineData(new string[] { "--configuration", "" }, @"-property:Configuration=\""\""")] - [InlineData(new string[] { "--version-suffix", "" }, @"-property:VersionSuffix=\""\""")] - [InlineData(new string[] { "-s" }, @"-property:Serviceable=\""true\""")] - [InlineData(new string[] { "--serviceable" }, @"-property:Serviceable=\""true\""")] + [InlineData(new string[] { "-o", "" }, "-property:PackageOutputPath=")] + [InlineData(new string[] { "--output", "" }, "-property:PackageOutputPath=")] + [InlineData(new string[] { "--no-build" }, "-property:NoBuild=true")] + [InlineData(new string[] { "--include-symbols" }, "-property:IncludeSymbols=true")] + [InlineData(new string[] { "--include-source" }, "-property:IncludeSource=true")] + [InlineData(new string[] { "-c", "" }, "-property:Configuration=")] + [InlineData(new string[] { "--configuration", "" }, "-property:Configuration=")] + [InlineData(new string[] { "--version-suffix", "" }, "-property:VersionSuffix=")] + [InlineData(new string[] { "-s" }, "-property:Serviceable=true")] + [InlineData(new string[] { "--serviceable" }, "-property:Serviceable=true")] [InlineData(new string[] { "-v", "diag" }, "-verbosity:diag")] [InlineData(new string[] { "--verbosity", "diag" }, "-verbosity:diag")] [InlineData(new string[] { "" }, "")] diff --git a/test/dotnet-msbuild.Tests/GivenDotnetPublishInvocation.cs b/test/dotnet-msbuild.Tests/GivenDotnetPublishInvocation.cs index 9e6e6220a..b66155261 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetPublishInvocation.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetPublishInvocation.cs @@ -24,14 +24,14 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests [Theory] [InlineData(new string[] { }, "")] - [InlineData(new string[] { "-r", "" }, @"-property:RuntimeIdentifier=\""\""")] - [InlineData(new string[] { "--runtime", "" }, @"-property:RuntimeIdentifier=\""\""")] - [InlineData(new string[] { "-o", "" }, @"-property:PublishDir=\""\""")] - [InlineData(new string[] { "--output", "" }, @"-property:PublishDir=\""\""")] - [InlineData(new string[] { "-c", "" }, @"-property:Configuration=\""\""")] - [InlineData(new string[] { "--configuration", "" }, @"-property:Configuration=\""\""")] - [InlineData(new string[] { "--version-suffix", "" }, @"-property:VersionSuffix=\""\""")] - [InlineData(new string[] { "--manifest", "" }, @"-property:TargetManifestFiles=\""\""")] + [InlineData(new string[] { "-r", "" }, "-property:RuntimeIdentifier=")] + [InlineData(new string[] { "--runtime", "" }, "-property:RuntimeIdentifier=")] + [InlineData(new string[] { "-o", "" }, "-property:PublishDir=")] + [InlineData(new string[] { "--output", "" }, "-property:PublishDir=")] + [InlineData(new string[] { "-c", "" }, "-property:Configuration=")] + [InlineData(new string[] { "--configuration", "" }, "-property:Configuration=")] + [InlineData(new string[] { "--version-suffix", "" }, "-property:VersionSuffix=")] + [InlineData(new string[] { "--manifest", "" }, "-property:TargetManifestFiles=")] [InlineData(new string[] { "-v", "minimal" }, "-verbosity:minimal")] [InlineData(new string[] { "--verbosity", "minimal" }, "-verbosity:minimal")] [InlineData(new string[] { "" }, "")] @@ -53,8 +53,8 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests } [Theory] - [InlineData(new string[] { "-f", "" }, @"-property:TargetFramework=\""\""")] - [InlineData(new string[] { "--framework", "" }, @"-property:TargetFramework=\""\""")] + [InlineData(new string[] { "-f", "" }, "-property:TargetFramework=")] + [InlineData(new string[] { "--framework", "" }, "-property:TargetFramework=")] public void MsbuildInvocationIsCorrectForSeparateRestore(string[] args, string expectedAdditionalArgs) { expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}"); @@ -86,7 +86,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests command.GetProcessStartInfo() .Arguments .Should() - .Be($"{ExpectedPrefix} -target:Publish -property:NoBuild=\\\"true\\\""); + .Be($"{ExpectedPrefix} -target:Publish -property:NoBuild=true"); } [Theory] diff --git a/test/dotnet-msbuild.Tests/GivenDotnetRestoreInvocation.cs b/test/dotnet-msbuild.Tests/GivenDotnetRestoreInvocation.cs index c1e515234..e4ae26741 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetRestoreInvocation.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetRestoreInvocation.cs @@ -15,18 +15,18 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests [Theory] [InlineData(new string[] { }, "")] - [InlineData(new string[] { "-s", "" }, @"-property:RestoreSources=\""\""")] - [InlineData(new string[] { "--source", "" }, @"-property:RestoreSources=\""\""")] - [InlineData(new string[] { "-s", "", "-s", "" }, @"-property:RestoreSources=\""%3B\""")] - [InlineData(new string[] { "-r", "" }, @"-property:RuntimeIdentifiers=\""\""")] - [InlineData(new string[] { "--runtime", "" }, @"-property:RuntimeIdentifiers=\""\""")] - [InlineData(new string[] { "-r", "", "-r", "" }, @"-property:RuntimeIdentifiers=\""%3B\""")] - [InlineData(new string[] { "--packages", "" }, @"-property:RestorePackagesPath=\""\""")] - [InlineData(new string[] { "--disable-parallel" }, @"-property:RestoreDisableParallel=\""true\""")] - [InlineData(new string[] { "--configfile", "" }, @"-property:RestoreConfigFile=\""\""")] - [InlineData(new string[] { "--no-cache" }, @"-property:RestoreNoCache=\""true\""")] - [InlineData(new string[] { "--ignore-failed-sources" }, @"-property:RestoreIgnoreFailedSources=\""true\""")] - [InlineData(new string[] { "--no-dependencies" }, @"-property:RestoreRecursive=\""false\""")] + [InlineData(new string[] { "-s", "" }, "-property:RestoreSources=")] + [InlineData(new string[] { "--source", "" }, "-property:RestoreSources=")] + [InlineData(new string[] { "-s", "", "-s", "" }, "-property:RestoreSources=%3B")] + [InlineData(new string[] { "-r", "" }, "-property:RuntimeIdentifiers=")] + [InlineData(new string[] { "--runtime", "" }, "-property:RuntimeIdentifiers=")] + [InlineData(new string[] { "-r", "", "-r", "" }, "-property:RuntimeIdentifiers=%3B")] + [InlineData(new string[] { "--packages", "" }, "-property:RestorePackagesPath=")] + [InlineData(new string[] { "--disable-parallel" }, "-property:RestoreDisableParallel=true")] + [InlineData(new string[] { "--configfile", "" }, "-property:RestoreConfigFile=")] + [InlineData(new string[] { "--no-cache" }, "-property:RestoreNoCache=true")] + [InlineData(new string[] { "--ignore-failed-sources" }, "-property:RestoreIgnoreFailedSources=true")] + [InlineData(new string[] { "--no-dependencies" }, "-property:RestoreRecursive=false")] [InlineData(new string[] { "-v", "minimal" }, @"-verbosity:minimal")] [InlineData(new string[] { "--verbosity", "minimal" }, @"-verbosity:minimal")] public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) diff --git a/test/dotnet-msbuild.Tests/GivenDotnetStoreInvocation.cs b/test/dotnet-msbuild.Tests/GivenDotnetStoreInvocation.cs index a7dd9459e..47854f569 100644 --- a/test/dotnet-msbuild.Tests/GivenDotnetStoreInvocation.cs +++ b/test/dotnet-msbuild.Tests/GivenDotnetStoreInvocation.cs @@ -26,11 +26,11 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests } [Theory] - [InlineData(new string[] { "-f", "" }, @"-property:TargetFramework=\""\""")] - [InlineData(new string[] { "--framework", "" }, @"-property:TargetFramework=\""\""")] - [InlineData(new string[] { "-r", "" }, @"-property:RuntimeIdentifier=\""\""")] - [InlineData(new string[] { "--runtime", "" }, @"-property:RuntimeIdentifier=\""\""")] - [InlineData(new string[] { "--manifest", "one.xml", "--manifest", "two.xml", "--manifest", "three.xml" }, @"-property:AdditionalProjects=\""one.xml%3Btwo.xml%3Bthree.xml\""")] + [InlineData(new string[] { "-f", "" }, @"-property:TargetFramework=")] + [InlineData(new string[] { "--framework", "" }, @"-property:TargetFramework=")] + [InlineData(new string[] { "-r", "" }, @"-property:RuntimeIdentifier=")] + [InlineData(new string[] { "--runtime", "" }, @"-property:RuntimeIdentifier=")] + [InlineData(new string[] { "--manifest", "one.xml", "--manifest", "two.xml", "--manifest", "three.xml" }, @"-property:AdditionalProjects=one.xml%3Btwo.xml%3Bthree.xml")] public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) { args = ArgsPrefix.Concat(args).ToArray(); @@ -51,7 +51,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests var msbuildPath = ""; StoreCommand.FromArgs(args, msbuildPath) - .GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix} -property:ComposeDir=\\\"{Path.GetFullPath(path)}\\\""); + .GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix} -property:ComposeDir={Path.GetFullPath(path)}"); } } }