aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2018-10-08 20:16:59 -0400
committerRob Mensching <rob@robmensching.com>2018-10-08 17:23:28 -0700
commit008a6fd58bfb40ed58a184aff40c3f01bb26391b (patch)
tree568ff309ecad8eea1615a37f2aaa5e3bf14e506b /src
parent34e49f5515995ec30d899879900473bbf07aeda1 (diff)
downloadwix-008a6fd58bfb40ed58a184aff40c3f01bb26391b.tar.gz
wix-008a6fd58bfb40ed58a184aff40c3f01bb26391b.tar.bz2
wix-008a6fd58bfb40ed58a184aff40c3f01bb26391b.zip
Handle the rename of WixCA and QtExec* binary, custom action, and property ids.
Fixed wixtoolset/issues#5887.
Diffstat (limited to 'src')
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v3.wxs65
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v4_expected.wxs64
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/QtExec/v3.wxs64
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/QtExec/v4_expected.wxs63
-rw-r--r--src/test/WixToolsetTest.WixCop/WixCopFixture.cs94
-rw-r--r--src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj4
-rw-r--r--src/wixcop/Converter.cs66
7 files changed, 418 insertions, 2 deletions
diff --git a/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v3.wxs b/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v3.wxs
new file mode 100644
index 00000000..b0630f65
--- /dev/null
+++ b/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v3.wxs
@@ -0,0 +1,65 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4
5
6<?include WixVer.wxi ?>
7
8<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:swid="http://schemas.microsoft.com/wix/TagExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
9 <Product Id="*" Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)"
10 Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D">
11 <Package Compressed="yes" InstallerVersion="200" SummaryCodepage="1252" InstallScope="perMachine" />
12 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
13
14 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
15
16 <MediaTemplate CabinetTemplate="core{0}.cab" />
17
18 <Property Id="QtExecCmdTimeout" Value="600000" />
19 <CustomAction Id="InstallVSTemplateCommand" Property="QtExecCmdLine" Value="&quot;[VSENVPRODUCT80]\devenv.exe&quot; /setup" />
20 <CustomAction Id="InstallVSTemplate" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="asyncWait" />
21
22 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
23 <Component Id="Licensing" Directory="INSTALLFOLDER">
24 <File Source="LICENSE.TXT" />
25 </Component>
26
27 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
28 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
29 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
30 </RegistryKey>
31 </Component>
32
33 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
34 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
35 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
36 </RegistryKey>
37 </Component>
38
39 <Component Id="ProductInformation" Directory="BinFolder">
40 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
41 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string"/>
42 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
43 </RegistryKey>
44
45 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
46 </Component>
47
48 <Component Directory="BinFolder">
49 <File Source="common\wixtoolset.org.ico" />
50 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
51 </Component>
52
53 <ComponentGroupRef Id="ToolsetComponents" />
54 <ComponentGroupRef Id="ExtensionComponents" />
55 <ComponentGroupRef Id="LuxComponents" />
56 <ComponentGroupRef Id="DocComponents" />
57 </Feature>
58
59 <FeatureRef Id="Feature_MSBuild" />
60 <FeatureRef Id="Feature_Intellisense2010" />
61 <FeatureRef Id="Feature_Intellisense2012" />
62 <FeatureRef Id="Feature_Intellisense2013" />
63 <FeatureRef Id="Feature_Intellisense2015" />
64 </Product>
65</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v4_expected.wxs b/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v4_expected.wxs
new file mode 100644
index 00000000..be487147
--- /dev/null
+++ b/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v4_expected.wxs
@@ -0,0 +1,64 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4
5
6<?include WixVer.wxi ?>
7
8<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
9 <Product Id="*" Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D">
10 <Package Compressed="yes" InstallerVersion="200" SummaryCodepage="1252" InstallScope="perMachine" />
11 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
12
13 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
14
15 <MediaTemplate CabinetTemplate="core{0}.cab" />
16
17 <Property Id="QtExecCmdTimeout" Value="600000" />
18 <CustomAction Id="InstallVSTemplateCommand" Property="WixQuietExecCmdLine" Value="&quot;[VSENVPRODUCT80]\devenv.exe&quot; /setup" />
19 <CustomAction Id="InstallVSTemplate" BinaryKey="UtilCA" DllEntry="WixQuietExec" Return="asyncWait" />
20
21 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
22 <Component Id="Licensing" Directory="INSTALLFOLDER">
23 <File Id="LICENSE.TXT" Source="LICENSE.TXT" />
24 </Component>
25
26 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
27 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
28 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
29 </RegistryKey>
30 </Component>
31
32 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
33 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
34 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
35 </RegistryKey>
36 </Component>
37
38 <Component Id="ProductInformation" Directory="BinFolder">
39 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
40 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string" />
41 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
42 </RegistryKey>
43
44 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
45 </Component>
46
47 <Component Directory="BinFolder">
48 <File Id="wixtoolset.org.ico" Source="common\wixtoolset.org.ico" />
49 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
50 </Component>
51
52 <ComponentGroupRef Id="ToolsetComponents" />
53 <ComponentGroupRef Id="ExtensionComponents" />
54 <ComponentGroupRef Id="LuxComponents" />
55 <ComponentGroupRef Id="DocComponents" />
56 </Feature>
57
58 <FeatureRef Id="Feature_MSBuild" />
59 <FeatureRef Id="Feature_Intellisense2010" />
60 <FeatureRef Id="Feature_Intellisense2012" />
61 <FeatureRef Id="Feature_Intellisense2013" />
62 <FeatureRef Id="Feature_Intellisense2015" />
63 </Product>
64</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/TestData/QtExec/v3.wxs b/src/test/WixToolsetTest.WixCop/TestData/QtExec/v3.wxs
new file mode 100644
index 00000000..8d81a758
--- /dev/null
+++ b/src/test/WixToolsetTest.WixCop/TestData/QtExec/v3.wxs
@@ -0,0 +1,64 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4
5
6<?include WixVer.wxi ?>
7
8<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:swid="http://schemas.microsoft.com/wix/TagExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
9 <Product Id="*" Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)"
10 Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D">
11 <Package Compressed="yes" InstallerVersion="200" SummaryCodepage="1252" InstallScope="perMachine" />
12 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
13
14 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
15
16 <MediaTemplate CabinetTemplate="core{0}.cab" />
17
18 <CustomAction Id="InstallVSTemplateCommand" Property="QtExecCmdLine" Value="&quot;[VSENVPRODUCT80]\devenv.exe&quot; /setup" />
19 <CustomAction Id="InstallVSTemplate" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="asyncWait" />
20
21 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
22 <Component Id="Licensing" Directory="INSTALLFOLDER">
23 <File Source="LICENSE.TXT" />
24 </Component>
25
26 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
27 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
28 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
29 </RegistryKey>
30 </Component>
31
32 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
33 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
34 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
35 </RegistryKey>
36 </Component>
37
38 <Component Id="ProductInformation" Directory="BinFolder">
39 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
40 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string"/>
41 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
42 </RegistryKey>
43
44 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
45 </Component>
46
47 <Component Directory="BinFolder">
48 <File Source="common\wixtoolset.org.ico" />
49 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
50 </Component>
51
52 <ComponentGroupRef Id="ToolsetComponents" />
53 <ComponentGroupRef Id="ExtensionComponents" />
54 <ComponentGroupRef Id="LuxComponents" />
55 <ComponentGroupRef Id="DocComponents" />
56 </Feature>
57
58 <FeatureRef Id="Feature_MSBuild" />
59 <FeatureRef Id="Feature_Intellisense2010" />
60 <FeatureRef Id="Feature_Intellisense2012" />
61 <FeatureRef Id="Feature_Intellisense2013" />
62 <FeatureRef Id="Feature_Intellisense2015" />
63 </Product>
64</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/TestData/QtExec/v4_expected.wxs b/src/test/WixToolsetTest.WixCop/TestData/QtExec/v4_expected.wxs
new file mode 100644
index 00000000..22a961b2
--- /dev/null
+++ b/src/test/WixToolsetTest.WixCop/TestData/QtExec/v4_expected.wxs
@@ -0,0 +1,63 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4
5
6<?include WixVer.wxi ?>
7
8<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
9 <Product Id="*" Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D">
10 <Package Compressed="yes" InstallerVersion="200" SummaryCodepage="1252" InstallScope="perMachine" />
11 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
12
13 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
14
15 <MediaTemplate CabinetTemplate="core{0}.cab" />
16
17 <CustomAction Id="InstallVSTemplateCommand" Property="WixQuietExecCmdLine" Value="&quot;[VSENVPRODUCT80]\devenv.exe&quot; /setup" />
18 <CustomAction Id="InstallVSTemplate" BinaryKey="UtilCA" DllEntry="WixQuietExec" Return="asyncWait" />
19
20 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
21 <Component Id="Licensing" Directory="INSTALLFOLDER">
22 <File Id="LICENSE.TXT" Source="LICENSE.TXT" />
23 </Component>
24
25 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
26 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
27 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
28 </RegistryKey>
29 </Component>
30
31 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
32 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
33 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
34 </RegistryKey>
35 </Component>
36
37 <Component Id="ProductInformation" Directory="BinFolder">
38 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
39 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string" />
40 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
41 </RegistryKey>
42
43 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
44 </Component>
45
46 <Component Directory="BinFolder">
47 <File Id="wixtoolset.org.ico" Source="common\wixtoolset.org.ico" />
48 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
49 </Component>
50
51 <ComponentGroupRef Id="ToolsetComponents" />
52 <ComponentGroupRef Id="ExtensionComponents" />
53 <ComponentGroupRef Id="LuxComponents" />
54 <ComponentGroupRef Id="DocComponents" />
55 </Feature>
56
57 <FeatureRef Id="Feature_MSBuild" />
58 <FeatureRef Id="Feature_Intellisense2010" />
59 <FeatureRef Id="Feature_Intellisense2012" />
60 <FeatureRef Id="Feature_Intellisense2013" />
61 <FeatureRef Id="Feature_Intellisense2015" />
62 </Product>
63</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/WixCopFixture.cs b/src/test/WixToolsetTest.WixCop/WixCopFixture.cs
index 9877f9c8..207782b7 100644
--- a/src/test/WixToolsetTest.WixCop/WixCopFixture.cs
+++ b/src/test/WixToolsetTest.WixCop/WixCopFixture.cs
@@ -3,6 +3,7 @@
3namespace WixToolsetTest.WixCop 3namespace WixToolsetTest.WixCop
4{ 4{
5 using System.IO; 5 using System.IO;
6 using System.Linq;
6 using WixBuildTools.TestSupport; 7 using WixBuildTools.TestSupport;
7 using Xunit; 8 using Xunit;
8 9
@@ -99,5 +100,98 @@ namespace WixToolsetTest.WixCop
99 Assert.Equal(0, result2.ExitCode); 100 Assert.Equal(0, result2.ExitCode);
100 } 101 }
101 } 102 }
103
104 [Fact]
105 public void CanConvertQtExec()
106 {
107 const string beforeFileName = "v3.wxs";
108 const string afterFileName = "v4_expected.wxs";
109 var folder = TestData.Get(@"TestData\QtExec");
110
111 using (var fs = new DisposableFileSystem())
112 {
113 var baseFolder = fs.GetFolder(true);
114 var targetFile = Path.Combine(baseFolder, beforeFileName);
115 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
116
117 var runner = new WixCopRunner
118 {
119 FixErrors = true,
120 SearchPatterns =
121 {
122 targetFile,
123 },
124 };
125
126 var result = runner.Execute();
127
128 Assert.Equal(2, result.ExitCode);
129
130 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
131 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
132 Assert.Equal(expected, actual);
133
134 var runner2 = new WixCopRunner
135 {
136 FixErrors = true,
137 SearchPatterns =
138 {
139 targetFile,
140 },
141 };
142
143 var result2 = runner2.Execute();
144
145 Assert.Equal(0, result2.ExitCode);
146 }
147 }
148
149 [Fact]
150 public void DetectUnconvertableQtExecCmdTimeout()
151 {
152 const string beforeFileName = "v3.wxs";
153 const string afterFileName = "v4_expected.wxs";
154 var folder = TestData.Get(@"TestData\QtExec.bad");
155
156 using (var fs = new DisposableFileSystem())
157 {
158 var baseFolder = fs.GetFolder(true);
159 var targetFile = Path.Combine(baseFolder, beforeFileName);
160 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
161
162 var runner = new WixCopRunner
163 {
164 FixErrors = true,
165 SearchPatterns =
166 {
167 targetFile,
168 },
169 };
170
171 var result = runner.Execute();
172
173 Assert.Equal(2, result.ExitCode);
174
175 Assert.Single(result.Messages.Where(message => message.ToString().EndsWith("(QtExecCmdTimeoutAmbiguous)")));
176
177 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
178 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
179 Assert.Equal(expected, actual);
180
181 // still fails because QtExecCmdTimeoutAmbiguous is unfixable
182 var runner2 = new WixCopRunner
183 {
184 FixErrors = true,
185 SearchPatterns =
186 {
187 targetFile,
188 },
189 };
190
191 var result2 = runner2.Execute();
192
193 Assert.Equal(2, result2.ExitCode);
194 }
195 }
102 } 196 }
103} 197}
diff --git a/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj b/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj
index 6b41b6b6..57de5a74 100644
--- a/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj
+++ b/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj
@@ -18,6 +18,10 @@
18 <Content Include="TestData\Preprocessor\ConvertedPreprocessor.wxs" CopyToOutputDirectory="PreserveNewest" /> 18 <Content Include="TestData\Preprocessor\ConvertedPreprocessor.wxs" CopyToOutputDirectory="PreserveNewest" />
19 <Content Include="TestData\Preprocessor\Preprocessor.wxs" CopyToOutputDirectory="PreserveNewest" /> 19 <Content Include="TestData\Preprocessor\Preprocessor.wxs" CopyToOutputDirectory="PreserveNewest" />
20 <Content Include="TestData\Preprocessor\wixcop.settings.xml" CopyToOutputDirectory="PreserveNewest" /> 20 <Content Include="TestData\Preprocessor\wixcop.settings.xml" CopyToOutputDirectory="PreserveNewest" />
21 <Content Include="TestData\QtExec\v3.wxs" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="TestData\QtExec\v4_expected.wxs" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="TestData\QtExec.bad\v3.wxs" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\QtExec.bad\v4_expected.wxs" CopyToOutputDirectory="PreserveNewest" />
21 </ItemGroup> 25 </ItemGroup>
22 26
23 <ItemGroup> 27 <ItemGroup>
diff --git a/src/wixcop/Converter.cs b/src/wixcop/Converter.cs
index e125b39c..5408d370 100644
--- a/src/wixcop/Converter.cs
+++ b/src/wixcop/Converter.cs
@@ -28,6 +28,8 @@ namespace WixToolset.Tools.WixCop
28 private static readonly XName MspPackageElementName = WixNamespace + "MspPackage"; 28 private static readonly XName MspPackageElementName = WixNamespace + "MspPackage";
29 private static readonly XName MsuPackageElementName = WixNamespace + "MsuPackage"; 29 private static readonly XName MsuPackageElementName = WixNamespace + "MsuPackage";
30 private static readonly XName PayloadElementName = WixNamespace + "Payload"; 30 private static readonly XName PayloadElementName = WixNamespace + "Payload";
31 private static readonly XName CustomActionElementName = WixNamespace + "CustomAction";
32 private static readonly XName PropertyElementName = WixNamespace + "Property";
31 private static readonly XName WixElementWithoutNamespaceName = XNamespace.None + "Wix"; 33 private static readonly XName WixElementWithoutNamespaceName = XNamespace.None + "Wix";
32 34
33 private static readonly Dictionary<string, XNamespace> OldToNewNamespaceMapping = new Dictionary<string, XNamespace>() 35 private static readonly Dictionary<string, XNamespace> OldToNewNamespaceMapping = new Dictionary<string, XNamespace>()
@@ -88,6 +90,8 @@ namespace WixToolset.Tools.WixCop
88 { Converter.MspPackageElementName, this.ConvertSuppressSignatureValidation }, 90 { Converter.MspPackageElementName, this.ConvertSuppressSignatureValidation },
89 { Converter.MsuPackageElementName, this.ConvertSuppressSignatureValidation }, 91 { Converter.MsuPackageElementName, this.ConvertSuppressSignatureValidation },
90 { Converter.PayloadElementName, this.ConvertSuppressSignatureValidation }, 92 { Converter.PayloadElementName, this.ConvertSuppressSignatureValidation },
93 { Converter.CustomActionElementName, this.ConvertCustomActionElement },
94 { Converter.PropertyElementName, this.ConvertPropertyElement },
91 { Converter.WixElementWithoutNamespaceName, this.ConvertWixElementWithoutNamespace } 95 { Converter.WixElementWithoutNamespaceName, this.ConvertWixElementWithoutNamespace }
92 }; 96 };
93 97
@@ -263,7 +267,7 @@ namespace WixToolset.Tools.WixCop
263 } 267 }
264 } 268 }
265 } 269 }
266 270
267 private void ConvertElement(XElement element) 271 private void ConvertElement(XElement element)
268 { 272 {
269 // Gather any deprecated namespaces, then update this element tree based on those deprecations. 273 // Gather any deprecated namespaces, then update this element tree based on those deprecations.
@@ -324,7 +328,7 @@ namespace WixToolset.Tools.WixCop
324 328
325 if (null != suppressSignatureValidation) 329 if (null != suppressSignatureValidation)
326 { 330 {
327 if (this.OnError(ConverterTestType.SuppressSignatureValidationDeprecated, element, "The chain package element contains deprecated '{0}' attribute. Use the 'EnableSignatureValidation' instead.", suppressSignatureValidation)) 331 if (this.OnError(ConverterTestType.SuppressSignatureValidationDeprecated, element, "The chain package element contains deprecated '{0}' attribute. Use the 'EnableSignatureValidation' attribute instead.", suppressSignatureValidation))
328 { 332 {
329 if ("no" == suppressSignatureValidation.Value) 333 if ("no" == suppressSignatureValidation.Value)
330 { 334 {
@@ -336,6 +340,49 @@ namespace WixToolset.Tools.WixCop
336 } 340 }
337 } 341 }
338 342
343 private void ConvertCustomActionElement(XElement xCustomAction)
344 {
345 var xBinaryKey = xCustomAction.Attribute("BinaryKey");
346
347 if (xBinaryKey?.Value == "WixCA")
348 {
349 if (this.OnError(ConverterTestType.WixCABinaryIdRenamed, xCustomAction, "The WixCA custom action DLL Binary table id has been renamed. Use the id 'UtilCA' instead."))
350 {
351 xBinaryKey.Value = "UtilCA";
352 }
353 }
354
355 var xDllEntry = xCustomAction.Attribute("DllEntry");
356
357 if (xDllEntry?.Value == "CAQuietExec" || xDllEntry?.Value == "CAQuietExec64")
358 {
359 if (this.OnError(ConverterTestType.QuietExecCustomActionsRenamed, xCustomAction, "The CAQuietExec and CAQuietExec64 custom action ids have been renamed. Use the ids 'WixQuietExec' and 'WixQuietExec64' instead."))
360 {
361 xDllEntry.Value = xDllEntry.Value.Replace("CAQuietExec", "WixQuietExec");
362 }
363 }
364
365 var xProperty = xCustomAction.Attribute("Property");
366
367 if (xProperty?.Value == "QtExecCmdLine" || xProperty?.Value == "QtExec64CmdLine")
368 {
369 if (this.OnError(ConverterTestType.QuietExecCustomActionsRenamed, xCustomAction, "The QtExecCmdLine and QtExec64CmdLine property ids have been renamed. Use the ids 'WixQuietExecCmdLine' and 'WixQuietExec64CmdLine' instead."))
370 {
371 xProperty.Value = xProperty.Value.Replace("QtExec", "WixQuietExec");
372 }
373 }
374 }
375
376 private void ConvertPropertyElement(XElement xProperty)
377 {
378 var xId = xProperty.Attribute("Id");
379
380 if (xId.Value == "QtExecCmdTimeout")
381 {
382 this.OnError(ConverterTestType.QtExecCmdTimeoutAmbiguous, xProperty, "QtExecCmdTimeout was previously used for both CAQuietExec and CAQuietExec64. For WixQuietExec, use WixQuietExecCmdTimeout. For WixQuietExec64, use WixQuietExec64CmdTimeout.");
383 }
384 }
385
339 /// <summary> 386 /// <summary>
340 /// Converts a Wix element. 387 /// Converts a Wix element.
341 /// </summary> 388 /// </summary>
@@ -549,6 +596,21 @@ namespace WixToolset.Tools.WixCop
549 /// SuppressSignatureValidation attribute is deprecated and replaced with EnableSignatureValidation. 596 /// SuppressSignatureValidation attribute is deprecated and replaced with EnableSignatureValidation.
550 /// </summary> 597 /// </summary>
551 SuppressSignatureValidationDeprecated, 598 SuppressSignatureValidationDeprecated,
599
600 /// <summary>
601 /// WixCA Binary/@Id has been renamed to UtilCA.
602 /// </summary>
603 WixCABinaryIdRenamed,
604
605 /// <summary>
606 /// QtExec custom actions have been renamed.
607 /// </summary>
608 QuietExecCustomActionsRenamed,
609
610 /// <summary>
611 /// QtExecCmdTimeout was previously used for both CAQuietExec and CAQuietExec64. For WixQuietExec, use WixQuietExecCmdTimeout. For WixQuietExec64, use WixQuietExec64CmdTimeout.
612 /// </summary>
613 QtExecCmdTimeoutAmbiguous,
552 } 614 }
553 } 615 }
554} 616}