diff options
Diffstat (limited to 'src')
5 files changed, 30 insertions, 30 deletions
diff --git a/src/internal/WixInternal.TestSupport/DisposableFileSystem.cs b/src/internal/WixInternal.TestSupport/DisposableFileSystem.cs index b03bbaa4..edf1f803 100644 --- a/src/internal/WixInternal.TestSupport/DisposableFileSystem.cs +++ b/src/internal/WixInternal.TestSupport/DisposableFileSystem.cs | |||
| @@ -35,7 +35,8 @@ namespace WixInternal.TestSupport | |||
| 35 | 35 | ||
| 36 | public string GetFolder(bool create = false) | 36 | public string GetFolder(bool create = false) |
| 37 | { | 37 | { |
| 38 | var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | 38 | // Always return a path with a space in it. |
| 39 | var path = Path.Combine(Path.GetTempPath(), ".WIXTEST " + Path.GetRandomFileName()); | ||
| 39 | 40 | ||
| 40 | if (create) | 41 | if (create) |
| 41 | { | 42 | { |
diff --git a/src/internal/WixInternal.TestSupport/ExternalExecutable.cs b/src/internal/WixInternal.TestSupport/ExternalExecutable.cs index e0345dfb..9effd843 100644 --- a/src/internal/WixInternal.TestSupport/ExternalExecutable.cs +++ b/src/internal/WixInternal.TestSupport/ExternalExecutable.cs | |||
| @@ -195,7 +195,7 @@ namespace WixInternal.TestSupport | |||
| 195 | sb.Append(' '); | 195 | sb.Append(' '); |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | if (arg.IndexOf(' ') > -1) | 198 | if (arg.IndexOf(' ') > -1 && !arg.EndsWith("\"")) |
| 199 | { | 199 | { |
| 200 | sb.Append("\""); | 200 | sb.Append("\""); |
| 201 | sb.Append(arg); | 201 | sb.Append(arg); |
diff --git a/src/internal/WixInternal.TestSupport/MsbuildUtilities.cs b/src/internal/WixInternal.TestSupport/MsbuildUtilities.cs index 5560f993..95b3e37b 100644 --- a/src/internal/WixInternal.TestSupport/MsbuildUtilities.cs +++ b/src/internal/WixInternal.TestSupport/MsbuildUtilities.cs | |||
| @@ -27,7 +27,7 @@ namespace WixToolsetTest.Sdk | |||
| 27 | // Node reuse means that child msbuild processes can stay around after the build completes. | 27 | // Node reuse means that child msbuild processes can stay around after the build completes. |
| 28 | // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. | 28 | // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. |
| 29 | "-nr:false", | 29 | "-nr:false", |
| 30 | $"-bl:{Path.ChangeExtension(projectPath, ".binlog")}" | 30 | MsbuildUtilities.GetQuotedSwitch(buildSystem, "bl", Path.ChangeExtension(projectPath, ".binlog")) |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | if (arguments != null) | 33 | if (arguments != null) |
| @@ -59,36 +59,35 @@ namespace WixToolsetTest.Sdk | |||
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | public static string GetQuotedPropertySwitch(BuildSystem buildSystem, string propertyName, string valueToQuote) | 62 | public static string GetQuotedSwitch(BuildSystem _, string switchName, string switchValue) |
| 63 | { | 63 | { |
| 64 | switch (buildSystem) | 64 | // If the value ends with a backslash, escape it. |
| 65 | if (switchValue?.EndsWith("\\") == true) | ||
| 65 | { | 66 | { |
| 66 | case BuildSystem.DotNetCoreSdk: | 67 | switchValue += @"\"; |
| 67 | { | 68 | } |
| 68 | // If the value ends with a backslash, double-escape it (it should end up with four backslashes). | ||
| 69 | if (valueToQuote?.EndsWith("\\") == true) | ||
| 70 | { | ||
| 71 | valueToQuote += @"\\\"; | ||
| 72 | } | ||
| 73 | 69 | ||
| 74 | return $"-p:{propertyName}=\\\"{valueToQuote}\\\""; | 70 | return $"-{switchName}:\"{switchValue}\""; |
| 75 | } | 71 | } |
| 76 | case BuildSystem.MSBuild: | ||
| 77 | case BuildSystem.MSBuild64: | ||
| 78 | { | ||
| 79 | // If the value ends with a backslash, escape it. | ||
| 80 | if (valueToQuote?.EndsWith("\\") == true) | ||
| 81 | { | ||
| 82 | valueToQuote += @"\"; | ||
| 83 | } | ||
| 84 | 72 | ||
| 85 | return $"-p:{propertyName}=\"{valueToQuote}\""; | 73 | public static string GetQuotedPropertySwitch(BuildSystem buildSystem, string propertyName, string propertyValue) |
| 86 | } | 74 | { |
| 87 | default: | 75 | // If the value ends with a backslash, escape it. |
| 88 | { | 76 | if (propertyValue?.EndsWith("\\") == true) |
| 89 | throw new NotImplementedException(); | 77 | { |
| 90 | } | 78 | propertyValue += @"\"; |
| 91 | } | 79 | } |
| 80 | |||
| 81 | var quotedValue = "\"" + propertyValue + "\""; | ||
| 82 | |||
| 83 | // If the value contains a semicolon then escape-quote it (wrap with the characters: \") to wrap the value | ||
| 84 | // instead of just quoting the value, otherwise dotnet.exe will not pass the value to MSBuild correctly. | ||
| 85 | if (buildSystem == BuildSystem.DotNetCoreSdk && propertyValue?.IndexOf(';') > -1) | ||
| 86 | { | ||
| 87 | quotedValue = "\\\"" + propertyValue + "\\\""; | ||
| 88 | } | ||
| 89 | |||
| 90 | return $"-p:{propertyName}={quotedValue}"; | ||
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | public static IEnumerable<string> GetToolCommandLines(MsbuildRunnerResult result, string toolName, string operation, BuildSystem buildSystem) | 93 | public static IEnumerable<string> GetToolCommandLines(MsbuildRunnerResult result, string toolName, string operation, BuildSystem buildSystem) |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs index f850615e..c27356c8 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs | |||
| @@ -572,7 +572,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 572 | 572 | ||
| 573 | private static void CreateAdminImage(string msiPath, string targetDir) | 573 | private static void CreateAdminImage(string msiPath, string targetDir) |
| 574 | { | 574 | { |
| 575 | var args = $"/a {Path.ChangeExtension(msiPath, "msi")} TARGETDIR={targetDir} /qn"; | 575 | var args = $"/a \"{Path.ChangeExtension(msiPath, "msi")}\" TARGETDIR=\"{targetDir}\" /qn"; |
| 576 | 576 | ||
| 577 | var proc = Process.Start("msiexec.exe", args); | 577 | var proc = Process.Start("msiexec.exe", args); |
| 578 | proc.WaitForExit(5000); | 578 | proc.WaitForExit(5000); |
diff --git a/src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs b/src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs index 6cbd445c..85774bfd 100644 --- a/src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs +++ b/src/wix/test/WixToolsetTest.Sdk/MsbuildFixture.cs | |||
| @@ -332,7 +332,7 @@ namespace WixToolsetTest.Sdk | |||
| 332 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] | 332 | var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] |
| 333 | { | 333 | { |
| 334 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildFixture.WixPropsPath), | 334 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildFixture.WixPropsPath), |
| 335 | $"-p:PdbOutputDir={pdbFolder}", | 335 | MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "PdbOutputDir", pdbFolder), |
| 336 | "-p:SuppressValidation=true" | 336 | "-p:SuppressValidation=true" |
| 337 | }); | 337 | }); |
| 338 | result.AssertSuccess(); | 338 | result.AssertSuccess(); |
