aboutsummaryrefslogtreecommitdiff
path: root/src/internal/WixBuildTools.TestSupport/MsbuildUtilities.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/internal/WixBuildTools.TestSupport/MsbuildUtilities.cs (renamed from src/wix/test/WixToolsetTest.Sdk/MsbuildUtilities.cs)16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/wix/test/WixToolsetTest.Sdk/MsbuildUtilities.cs b/src/internal/WixBuildTools.TestSupport/MsbuildUtilities.cs
index 028ea0cf..32680e5d 100644
--- a/src/wix/test/WixToolsetTest.Sdk/MsbuildUtilities.cs
+++ b/src/internal/WixBuildTools.TestSupport/MsbuildUtilities.cs
@@ -17,9 +17,6 @@ namespace WixToolsetTest.Sdk
17 17
18 public static class MsbuildUtilities 18 public static class MsbuildUtilities
19 { 19 {
20 public static readonly string WixMsbuildPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(MsbuildUtilities).Assembly.CodeBase).AbsolutePath), "..", "..", "..", "publish", "WixToolset.Sdk");
21 public static readonly string WixPropsPath = Path.Combine(WixMsbuildPath, "build", "WixToolset.Sdk.props");
22
23 public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", bool? outOfProc = null, string verbosityLevel = "normal", bool suppressValidation = true) 20 public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", bool? outOfProc = null, string verbosityLevel = "normal", bool suppressValidation = true)
24 { 21 {
25 var allArgs = new List<string> 22 var allArgs = new List<string>
@@ -27,7 +24,6 @@ namespace WixToolsetTest.Sdk
27 $"-verbosity:{verbosityLevel}", 24 $"-verbosity:{verbosityLevel}",
28 $"-p:Configuration={configuration}", 25 $"-p:Configuration={configuration}",
29 $"-p:SuppressValidation={suppressValidation}", 26 $"-p:SuppressValidation={suppressValidation}",
30 GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildUtilities.WixPropsPath),
31 // 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.
32 // 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.
33 "-nr:false", 29 "-nr:false",
@@ -74,11 +70,23 @@ namespace WixToolsetTest.Sdk
74 { 70 {
75 case BuildSystem.DotNetCoreSdk: 71 case BuildSystem.DotNetCoreSdk:
76 { 72 {
73 // If the value ends with a backslash, double-escape it (it should end up with four backslashes).
74 if (valueToQuote?.EndsWith("\\") == true)
75 {
76 valueToQuote += @"\\\";
77 }
78
77 return $"-p:{propertyName}=\\\"{valueToQuote}\\\""; 79 return $"-p:{propertyName}=\\\"{valueToQuote}\\\"";
78 } 80 }
79 case BuildSystem.MSBuild: 81 case BuildSystem.MSBuild:
80 case BuildSystem.MSBuild64: 82 case BuildSystem.MSBuild64:
81 { 83 {
84 // If the value ends with a backslash, escape it.
85 if (valueToQuote?.EndsWith("\\") == true)
86 {
87 valueToQuote += @"\";
88 }
89
82 return $"-p:{propertyName}=\"{valueToQuote}\""; 90 return $"-p:{propertyName}=\"{valueToQuote}\"";
83 } 91 }
84 default: 92 default: