aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2019-11-10 18:19:36 -0500
committerBob Arnson <bob@firegiant.com>2019-11-10 18:31:56 -0500
commitdf709d87c25945c10b9d29273dd90b6df6359a99 (patch)
treecd4cfca3ce6f548988a35cf38b7e428e3600505e /src
parente29c25090e26c8cca52232d580528840d1161b73 (diff)
downloadwix-df709d87c25945c10b9d29273dd90b6df6359a99.tar.gz
wix-df709d87c25945c10b9d29273dd90b6df6359a99.tar.bz2
wix-df709d87c25945c10b9d29273dd90b6df6359a99.zip
Clean up upgrade properties; support <?ifdef $()?>
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core/Compiler.cs6
-rw-r--r--src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs4
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs2
3 files changed, 4 insertions, 8 deletions
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs
index b983981b..56d3a8b4 100644
--- a/src/WixToolset.Core/Compiler.cs
+++ b/src/WixToolset.Core/Compiler.cs
@@ -7137,9 +7137,6 @@ namespace WixToolset.Core
7137 7137
7138 this.Core.AddTuple(tuple); 7138 this.Core.AddTuple(tuple);
7139 7139
7140 // Ensure the action property is secure.
7141 this.AddWixPropertyRow(sourceLineNumbers, new Identifier(AccessModifier.Public, Common.UpgradeDetectedProperty), false, true, false);
7142
7143 // Add launch condition that blocks upgrades 7140 // Add launch condition that blocks upgrades
7144 if (blockUpgrades) 7141 if (blockUpgrades)
7145 { 7142 {
@@ -7167,9 +7164,6 @@ namespace WixToolset.Core
7167 7164
7168 this.Core.AddTuple(upgradeTuple); 7165 this.Core.AddTuple(upgradeTuple);
7169 7166
7170 // Ensure the action property is secure.
7171 this.AddWixPropertyRow(sourceLineNumbers, new Identifier(AccessModifier.Public, Common.DowngradeDetectedProperty), false, true, false);
7172
7173 var conditionTuple = new LaunchConditionTuple(sourceLineNumbers) 7167 var conditionTuple = new LaunchConditionTuple(sourceLineNumbers)
7174 { 7168 {
7175 Condition = Common.DowngradePreventedCondition, 7169 Condition = Common.DowngradePreventedCondition,
diff --git a/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs b/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs
index 60726a02..215c7bc4 100644
--- a/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs
+++ b/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs
@@ -154,10 +154,10 @@ namespace WixToolset.Core.ExtensibilityServices
154 154
155 public string GetVariableValue(IPreprocessContext context, string variable, bool allowMissingPrefix) 155 public string GetVariableValue(IPreprocessContext context, string variable, bool allowMissingPrefix)
156 { 156 {
157 // Strip the "$(" off the front. 157 // Strip the "$(" off the front and the ")" off the back.
158 if (variable.StartsWith("$(", StringComparison.Ordinal)) 158 if (variable.StartsWith("$(", StringComparison.Ordinal))
159 { 159 {
160 variable = variable.Substring(2); 160 variable = variable.Substring(2, variable.Length - 3);
161 } 161 }
162 162
163 var parts = variable.Split(VariableSplitter, 2); 163 var parts = variable.Split(VariableSplitter, 2);
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs
index 9f5e3f34..57c24f57 100644
--- a/src/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs
@@ -6,9 +6,11 @@
6<?define Bar = "Bar" ?> 6<?define Bar = "Bar" ?>
7<?define Bar = "Baz" ?> 7<?define Bar = "Baz" ?>
8 8
9<?ifdef $(sys.WIXVERSION) ?>
9<?if $(sys.WIXMAJORVERSION) >= 4 AND $(sys.WIXMAJORVERSION) < 5 ?> 10<?if $(sys.WIXMAJORVERSION) >= 4 AND $(sys.WIXMAJORVERSION) < 5 ?>
10 <?warning WiX v4 is in effect! ?> 11 <?warning WiX v4 is in effect! ?>
11<?endif?> 12<?endif?>
13<?endif?>
12 14
13<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> 15<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
14 <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> 16 <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">