aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v3.wxs27
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v4_expected.wxs27
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/Preprocessor/ConvertedPreprocessor.wxs62
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/Preprocessor/Preprocessor.wxs63
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/Preprocessor/wixcop.settings.xml9
-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/TestData/SingleFile/ConvertedSingleFile.wxs60
-rw-r--r--src/test/WixToolsetTest.WixCop/TestData/SingleFile/SingleFile.wxs61
-rw-r--r--src/test/WixToolsetTest.WixCop/WixCopFixture.cs242
-rw-r--r--src/test/WixToolsetTest.WixCop/WixCopRunner.cs68
-rw-r--r--src/test/WixToolsetTest.WixCop/WixCopRunnerResult.cs22
-rw-r--r--src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj51
-rw-r--r--src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.v3.ncrunchproject6
-rw-r--r--src/wix/ConsoleMessageListener.cs (renamed from src/WixToolset.Tools.Core/ConsoleMessageListener.cs)0
-rw-r--r--src/wix/Program.cs4
-rw-r--r--src/wix/app.config10
-rw-r--r--src/wix/wix.csproj5
-rw-r--r--src/wix/wix.exe.manifest4
-rw-r--r--src/wixcop/CommandLine/ConvertCommand.cs224
-rw-r--r--src/wixcop/CommandLine/HelpCommand.cs37
-rw-r--r--src/wixcop/CommandLine/WixCopCommandLineParser.cs135
-rw-r--r--src/wixcop/Interfaces/IWixCopCommandLineParser.cs13
-rw-r--r--src/wixcop/Program.cs79
-rw-r--r--src/wixcop/WixCop.csproj35
-rw-r--r--src/wixcop/WixCop.net461.v3.ncrunchproject5
-rw-r--r--src/wixcop/WixCop.netcoreapp2.1.v3.ncrunchproject5
-rw-r--r--src/wixcop/app.config10
-rw-r--r--src/wixcop/wixcop.exe.manifest20
31 files changed, 9 insertions, 1531 deletions
diff --git a/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v3.wxs b/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v3.wxs
deleted file mode 100644
index 0e241544..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v3.wxs
+++ /dev/null
@@ -1,27 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component>
6 <File Source="example.txt">
7 <util:PermissionEx User="Everyone" GenericAll="yes" />
8 </File>
9 <CreateFolder>
10 <util:PermissionEx User="Everyone" GenericAll="yes" />
11 </CreateFolder>
12 <ServiceInstall Name="testsvc" Type="ownProcess" Start="disabled" ErrorControl="normal">
13 <util:PermissionEx User="Everyone" GenericAll="yes" />
14 </ServiceInstall>
15 <Registry Action="createKey" Root="HKLM" Key="TestKey">
16 <util:PermissionEx User="Everyone" GenericAll="yes" />
17 </Registry>
18 <RegistryKey Id="ExampleRegistryKey" ForceCreateOnInstall="yes" Root="HKLM" Key="TestRegistryKey">
19 <util:PermissionEx User="Everyone" GenericAll="yes" />
20 </RegistryKey>
21 <RegistryValue Root="HKLM" Key="TestRegistryValueKey" Value="abc">
22 <util:PermissionEx User="Everyone" GenericAll="yes" />
23 </RegistryValue>
24 </Component>
25 </ComponentGroup>
26 </Fragment>
27</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v4_expected.wxs b/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v4_expected.wxs
deleted file mode 100644
index 375b70d3..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v4_expected.wxs
+++ /dev/null
@@ -1,27 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component>
6 <File Id="example.txt" Source="example.txt">
7 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
8 </File>
9 <CreateFolder>
10 <util:PermissionEx User="Everyone" GenericAll="yes" />
11 </CreateFolder>
12 <ServiceInstall Name="testsvc" Type="ownProcess" Start="disabled" ErrorControl="normal">
13 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
14 </ServiceInstall>
15 <Registry Action="createKey" Root="HKLM" Key="TestKey">
16 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
17 </Registry>
18 <RegistryKey Id="ExampleRegistryKey" ForceCreateOnInstall="yes" Root="HKLM" Key="TestRegistryKey">
19 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
20 </RegistryKey>
21 <RegistryValue Root="HKLM" Key="TestRegistryValueKey" Value="abc">
22 <util:PermissionEx User="Everyone" GenericAll="yes" Inheritable="no" />
23 </RegistryValue>
24 </Component>
25 </ComponentGroup>
26 </Fragment>
27</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/TestData/Preprocessor/ConvertedPreprocessor.wxs b/src/test/WixToolsetTest.WixCop/TestData/Preprocessor/ConvertedPreprocessor.wxs
deleted file mode 100644
index dcd43e35..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/Preprocessor/ConvertedPreprocessor.wxs
+++ /dev/null
@@ -1,62 +0,0 @@
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 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
18 <Component Id="Licensing" Directory="INSTALLFOLDER">
19 <File Id="LICENSE.TXT" Source="LICENSE.TXT" />
20 </Component>
21
22 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
23 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
24 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
25 </RegistryKey>
26 </Component>
27
28 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
29 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
30 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
31 </RegistryKey>
32 </Component>
33
34 <Component Id="ProductInformation" Directory="BinFolder">
35 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
36 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string" />
37 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
38 </RegistryKey>
39
40 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
41 </Component>
42
43 <Component Directory="BinFolder">
44 <File Id="wixtoolset.org.ico" Source="common\wixtoolset.org.ico">
45 <?include ComRegistration.wxi ?>
46 </File>
47 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
48 </Component>
49
50 <ComponentGroupRef Id="ToolsetComponents" />
51 <ComponentGroupRef Id="ExtensionComponents" />
52 <ComponentGroupRef Id="LuxComponents" />
53 <ComponentGroupRef Id="DocComponents" />
54 </Feature>
55
56 <FeatureRef Id="Feature_MSBuild" />
57 <FeatureRef Id="Feature_Intellisense2010" />
58 <FeatureRef Id="Feature_Intellisense2012" />
59 <FeatureRef Id="Feature_Intellisense2013" />
60 <FeatureRef Id="Feature_Intellisense2015" />
61 </Product>
62</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/TestData/Preprocessor/Preprocessor.wxs b/src/test/WixToolsetTest.WixCop/TestData/Preprocessor/Preprocessor.wxs
deleted file mode 100644
index 2eb908c2..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/Preprocessor/Preprocessor.wxs
+++ /dev/null
@@ -1,63 +0,0 @@
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 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
19 <Component Id="Licensing" Directory="INSTALLFOLDER">
20 <File Source="LICENSE.TXT" />
21 </Component>
22
23 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
24 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
25 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
26 </RegistryKey>
27 </Component>
28
29 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
30 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
31 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
32 </RegistryKey>
33 </Component>
34
35 <Component Id="ProductInformation" Directory="BinFolder">
36 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
37 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string"/>
38 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
39 </RegistryKey>
40
41 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
42 </Component>
43
44 <Component Directory="BinFolder">
45 <File Source="common\wixtoolset.org.ico">
46 <?include ComRegistration.wxi ?>
47 </File>
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/TestData/Preprocessor/wixcop.settings.xml b/src/test/WixToolsetTest.WixCop/TestData/Preprocessor/wixcop.settings.xml
deleted file mode 100644
index 9d3ad496..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/Preprocessor/wixcop.settings.xml
+++ /dev/null
@@ -1,9 +0,0 @@
1<?xml version="1.0"?>
2<Settings>
3 <IgnoreErrors>
4 <Test Id="WhitespacePrecedingNodeWrong"/>
5 <Test Id="WhitespacePrecedingEndElementWrong"/>
6 </IgnoreErrors>
7 <ErrorsAsWarnings/>
8 <ExemptFiles/>
9</Settings> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v3.wxs b/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v3.wxs
deleted file mode 100644
index b0630f65..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v3.wxs
+++ /dev/null
@@ -1,65 +0,0 @@
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
deleted file mode 100644
index b28c94e4..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/QtExec.bad/v4_expected.wxs
+++ /dev/null
@@ -1,64 +0,0 @@
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="Wix4UtilCA_X86" 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
deleted file mode 100644
index 8d81a758..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/QtExec/v3.wxs
+++ /dev/null
@@ -1,64 +0,0 @@
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
deleted file mode 100644
index 99cc2151..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/QtExec/v4_expected.wxs
+++ /dev/null
@@ -1,63 +0,0 @@
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="Wix4UtilCA_X86" 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/TestData/SingleFile/ConvertedSingleFile.wxs b/src/test/WixToolsetTest.WixCop/TestData/SingleFile/ConvertedSingleFile.wxs
deleted file mode 100644
index aacb68fa..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/SingleFile/ConvertedSingleFile.wxs
+++ /dev/null
@@ -1,60 +0,0 @@
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 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
18 <Component Id="Licensing" Directory="INSTALLFOLDER">
19 <File Id="LICENSE.TXT" Source="LICENSE.TXT" />
20 </Component>
21
22 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
23 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
24 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
25 </RegistryKey>
26 </Component>
27
28 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
29 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
30 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
31 </RegistryKey>
32 </Component>
33
34 <Component Id="ProductInformation" Directory="BinFolder">
35 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
36 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string" />
37 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
38 </RegistryKey>
39
40 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
41 </Component>
42
43 <Component Directory="BinFolder">
44 <File Id="wixtoolset.org.ico" Source="common\wixtoolset.org.ico" />
45 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
46 </Component>
47
48 <ComponentGroupRef Id="ToolsetComponents" />
49 <ComponentGroupRef Id="ExtensionComponents" />
50 <ComponentGroupRef Id="LuxComponents" />
51 <ComponentGroupRef Id="DocComponents" />
52 </Feature>
53
54 <FeatureRef Id="Feature_MSBuild" />
55 <FeatureRef Id="Feature_Intellisense2010" />
56 <FeatureRef Id="Feature_Intellisense2012" />
57 <FeatureRef Id="Feature_Intellisense2013" />
58 <FeatureRef Id="Feature_Intellisense2015" />
59 </Product>
60</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/TestData/SingleFile/SingleFile.wxs b/src/test/WixToolsetTest.WixCop/TestData/SingleFile/SingleFile.wxs
deleted file mode 100644
index 310ae811..00000000
--- a/src/test/WixToolsetTest.WixCop/TestData/SingleFile/SingleFile.wxs
+++ /dev/null
@@ -1,61 +0,0 @@
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 <Feature Id="Feature_WiX" Title="WiX Toolset" Level="1">
19 <Component Id="Licensing" Directory="INSTALLFOLDER">
20 <File Source="LICENSE.TXT" />
21 </Component>
22
23 <Component Id="ProductRegistration" Directory="INSTALLFOLDER">
24 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
25 <RegistryValue Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
26 </RegistryKey>
27 </Component>
28
29 <Component Id="ProductFamilyRegistration" Directory="INSTALLFOLDER">
30 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajor).x">
31 <RegistryValue Name="v$(var.WixMajorMinor)" Value="[INSTALLFOLDER]" Type="string" />
32 </RegistryKey>
33 </Component>
34
35 <Component Id="ProductInformation" Directory="BinFolder">
36 <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows Installer XML\$(var.WixMajorMinor)">
37 <RegistryValue Name="InstallRoot" Value="[BinFolder]" Type="string"/>
38 <RegistryValue Name="ProductVersion" Value="[ProductVersion]" Type="string" />
39 </RegistryKey>
40
41 <RemoveFolder Id="CleanupShortcutFolder" Directory="ShortcutFolder" On="uninstall" />
42 </Component>
43
44 <Component Directory="BinFolder">
45 <File Source="common\wixtoolset.org.ico" />
46 <util:InternetShortcut Id="wixtoolset.org" Directory="ShortcutFolder" Name="WiX Home Page" Target="http://wixtoolset.org/" IconFile="file://[#wixtoolset.org.ico]" />
47 </Component>
48
49 <ComponentGroupRef Id="ToolsetComponents" />
50 <ComponentGroupRef Id="ExtensionComponents" />
51 <ComponentGroupRef Id="LuxComponents" />
52 <ComponentGroupRef Id="DocComponents" />
53 </Feature>
54
55 <FeatureRef Id="Feature_MSBuild" />
56 <FeatureRef Id="Feature_Intellisense2010" />
57 <FeatureRef Id="Feature_Intellisense2012" />
58 <FeatureRef Id="Feature_Intellisense2013" />
59 <FeatureRef Id="Feature_Intellisense2015" />
60 </Product>
61</Wix>
diff --git a/src/test/WixToolsetTest.WixCop/WixCopFixture.cs b/src/test/WixToolsetTest.WixCop/WixCopFixture.cs
deleted file mode 100644
index 72a36dd6..00000000
--- a/src/test/WixToolsetTest.WixCop/WixCopFixture.cs
+++ /dev/null
@@ -1,242 +0,0 @@
1// 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.
2
3namespace WixToolsetTest.WixCop
4{
5 using System.IO;
6 using System.Linq;
7 using WixBuildTools.TestSupport;
8 using Xunit;
9
10 public class WixCopFixture
11 {
12 [Fact]
13 public void CanConvertPermissionExFile()
14 {
15 const string beforeFileName = "v3.wxs";
16 const string afterFileName = "v4_expected.wxs";
17 var folder = TestData.Get(@"TestData\PermissionEx");
18
19 using (var fs = new DisposableFileSystem())
20 {
21 var baseFolder = fs.GetFolder(true);
22 var targetFile = Path.Combine(baseFolder, beforeFileName);
23 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
24
25 var runner = new WixCopRunner
26 {
27 FixErrors = true,
28 SearchPatterns =
29 {
30 targetFile,
31 },
32 };
33
34 var result = runner.Execute();
35
36 Assert.Equal(2, result.ExitCode);
37
38 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
39 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
40 Assert.Equal(expected, actual);
41
42 var runner2 = new WixCopRunner
43 {
44 FixErrors = true,
45 SearchPatterns =
46 {
47 targetFile,
48 },
49 };
50
51 var result2 = runner2.Execute();
52
53 Assert.Equal(0, result2.ExitCode);
54 }
55 }
56
57 [Fact]
58 public void CanConvertSingleFile()
59 {
60 const string beforeFileName = "SingleFile.wxs";
61 const string afterFileName = "ConvertedSingleFile.wxs";
62 var folder = TestData.Get(@"TestData\SingleFile");
63
64 using (var fs = new DisposableFileSystem())
65 {
66 var baseFolder = fs.GetFolder(true);
67 var targetFile = Path.Combine(baseFolder, beforeFileName);
68 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
69
70 var runner = new WixCopRunner
71 {
72 FixErrors = true,
73 SearchPatterns =
74 {
75 targetFile,
76 },
77 };
78
79 var result = runner.Execute();
80
81 Assert.Equal(2, result.ExitCode);
82
83 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
84 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
85 Assert.Equal(expected, actual);
86
87 var runner2 = new WixCopRunner
88 {
89 FixErrors = true,
90 SearchPatterns =
91 {
92 targetFile,
93 },
94 };
95
96 var result2 = runner2.Execute();
97
98 Assert.Equal(0, result2.ExitCode);
99 }
100 }
101
102 [Fact]
103 public void RetainsPreprocessorInstructions()
104 {
105 const string beforeFileName = "Preprocessor.wxs";
106 const string afterFileName = "ConvertedPreprocessor.wxs";
107 var folder = TestData.Get(@"TestData\Preprocessor");
108
109 using (var fs = new DisposableFileSystem())
110 {
111 var baseFolder = fs.GetFolder(true);
112 var targetFile = Path.Combine(baseFolder, beforeFileName);
113 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
114
115 var runner = new WixCopRunner
116 {
117 FixErrors = true,
118 SettingFile1 = Path.Combine(folder, "wixcop.settings.xml"),
119 SearchPatterns =
120 {
121 targetFile,
122 },
123 };
124
125 var result = runner.Execute();
126
127 Assert.Equal(2, result.ExitCode);
128
129 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
130 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
131 Assert.Equal(expected, actual);
132
133 var runner2 = new WixCopRunner
134 {
135 FixErrors = true,
136 SettingFile1 = Path.Combine(folder, "wixcop.settings.xml"),
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 CanConvertQtExec()
151 {
152 const string beforeFileName = "v3.wxs";
153 const string afterFileName = "v4_expected.wxs";
154 var folder = TestData.Get(@"TestData\QtExec");
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 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
176 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
177 Assert.Equal(expected, actual);
178
179 var runner2 = new WixCopRunner
180 {
181 FixErrors = true,
182 SearchPatterns =
183 {
184 targetFile,
185 },
186 };
187
188 var result2 = runner2.Execute();
189
190 Assert.Equal(0, result2.ExitCode);
191 }
192 }
193
194 [Fact]
195 public void DetectUnconvertableQtExecCmdTimeout()
196 {
197 const string beforeFileName = "v3.wxs";
198 const string afterFileName = "v4_expected.wxs";
199 var folder = TestData.Get(@"TestData\QtExec.bad");
200
201 using (var fs = new DisposableFileSystem())
202 {
203 var baseFolder = fs.GetFolder(true);
204 var targetFile = Path.Combine(baseFolder, beforeFileName);
205 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
206
207 var runner = new WixCopRunner
208 {
209 FixErrors = true,
210 SearchPatterns =
211 {
212 targetFile,
213 },
214 };
215
216 var result = runner.Execute();
217
218 Assert.Equal(2, result.ExitCode);
219
220 Assert.Single(result.Messages.Where(message => message.ToString().EndsWith("(QtExecCmdTimeoutAmbiguous)")));
221
222 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
223 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
224 Assert.Equal(expected, actual);
225
226 // still fails because QtExecCmdTimeoutAmbiguous is unfixable
227 var runner2 = new WixCopRunner
228 {
229 FixErrors = true,
230 SearchPatterns =
231 {
232 targetFile,
233 },
234 };
235
236 var result2 = runner2.Execute();
237
238 Assert.Equal(2, result2.ExitCode);
239 }
240 }
241 }
242}
diff --git a/src/test/WixToolsetTest.WixCop/WixCopRunner.cs b/src/test/WixToolsetTest.WixCop/WixCopRunner.cs
deleted file mode 100644
index d2a0abbe..00000000
--- a/src/test/WixToolsetTest.WixCop/WixCopRunner.cs
+++ /dev/null
@@ -1,68 +0,0 @@
1// 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.
2
3namespace WixToolsetTest.WixCop
4{
5 using System;
6 using System.Collections.Generic;
7 using WixToolset.Core;
8 using WixToolset.Core.TestPackage;
9 using WixToolset.Extensibility;
10 using WixToolset.Extensibility.Services;
11 using WixToolset.Tools.WixCop;
12 using WixToolset.Tools.WixCop.CommandLine;
13 using WixToolset.Tools.WixCop.Interfaces;
14
15 public class WixCopRunner
16 {
17 public bool FixErrors { get; set; }
18
19 public List<string> SearchPatterns { get; } = new List<string>();
20
21 public string SettingFile1 { get; set; }
22
23 public WixCopRunnerResult Execute()
24 {
25 var argList = new List<string>();
26
27 if (this.FixErrors)
28 {
29 argList.Add("-f");
30 }
31
32 if (!String.IsNullOrEmpty(this.SettingFile1))
33 {
34 argList.Add($"-set1{this.SettingFile1}");
35 }
36
37 foreach (var searchPattern in this.SearchPatterns)
38 {
39 argList.Add(searchPattern);
40 }
41
42 return WixCopRunner.Execute(argList.ToArray());
43 }
44
45 public static WixCopRunnerResult Execute(string[] args)
46 {
47 var listener = new TestMessageListener();
48
49 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider();
50 serviceProvider.AddService<IMessageListener>((x, y) => listener);
51 serviceProvider.AddService<IWixCopCommandLineParser>((x, y) => new WixCopCommandLineParser(x));
52
53 var exitCode = Execute(serviceProvider, args);
54
55 return new WixCopRunnerResult
56 {
57 ExitCode = exitCode,
58 Messages = listener.Messages.ToArray()
59 };
60 }
61
62 public static int Execute(IWixToolsetServiceProvider serviceProvider, string[] args)
63 {
64 var wixcop = new Program();
65 return wixcop.Run(serviceProvider, args);
66 }
67 }
68}
diff --git a/src/test/WixToolsetTest.WixCop/WixCopRunnerResult.cs b/src/test/WixToolsetTest.WixCop/WixCopRunnerResult.cs
deleted file mode 100644
index 1b35e491..00000000
--- a/src/test/WixToolsetTest.WixCop/WixCopRunnerResult.cs
+++ /dev/null
@@ -1,22 +0,0 @@
1// 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.
2
3namespace WixToolsetTest.WixCop
4{
5 using System;
6 using System.Linq;
7 using WixToolset.Data;
8 using Xunit;
9
10 public class WixCopRunnerResult
11 {
12 public int ExitCode { get; set; }
13
14 public Message[] Messages { get; set; }
15
16 public WixCopRunnerResult AssertSuccess()
17 {
18 Assert.True(0 == this.ExitCode, $"WixCop failed unexpectedly. Output:\r\n{String.Join("\r\n", this.Messages.Select(m => m.ToString()).ToArray())}");
19 return this;
20 }
21 }
22}
diff --git a/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj b/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj
deleted file mode 100644
index 3ea4dae5..00000000
--- a/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj
+++ /dev/null
@@ -1,51 +0,0 @@
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<Project Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup>
6 <TargetFramework>net461</TargetFramework>
7 <IsPackable>false</IsPackable>
8 <DebugType>embedded</DebugType>
9 <RuntimeIdentifier>win-x86</RuntimeIdentifier>
10 </PropertyGroup>
11
12 <PropertyGroup>
13 <NoWarn>NU1603</NoWarn>
14 </PropertyGroup>
15
16 <ItemGroup>
17 <None Remove="TestData\SingleFile\ConvertedSingleFile.wxs" />
18 <None Remove="TestData\SingleFile\SingleFile.wxs" />
19 </ItemGroup>
20 <ItemGroup>
21 <Content Include="TestData\PermissionEx\v3.wxs" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="TestData\PermissionEx\v4_expected.wxs" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="TestData\Preprocessor\ConvertedPreprocessor.wxs" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\Preprocessor\Preprocessor.wxs" CopyToOutputDirectory="PreserveNewest" />
25 <Content Include="TestData\Preprocessor\wixcop.settings.xml" CopyToOutputDirectory="PreserveNewest" />
26 <Content Include="TestData\QtExec\v3.wxs" CopyToOutputDirectory="PreserveNewest" />
27 <Content Include="TestData\QtExec\v4_expected.wxs" CopyToOutputDirectory="PreserveNewest" />
28 <Content Include="TestData\QtExec.bad\v3.wxs" CopyToOutputDirectory="PreserveNewest" />
29 <Content Include="TestData\QtExec.bad\v4_expected.wxs" CopyToOutputDirectory="PreserveNewest" />
30 <Content Include="TestData\SingleFile\ConvertedSingleFile.wxs" CopyToOutputDirectory="PreserveNewest" />
31 <Content Include="TestData\SingleFile\SingleFile.wxs" CopyToOutputDirectory="PreserveNewest" />
32 </ItemGroup>
33
34 <ItemGroup>
35 <ProjectReference Include="..\..\wixcop\WixCop.csproj" />
36 </ItemGroup>
37
38 <ItemGroup>
39 <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" />
40 </ItemGroup>
41
42 <ItemGroup>
43 <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
44 </ItemGroup>
45
46 <ItemGroup>
47 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
48 <PackageReference Include="xunit" Version="2.4.1" />
49 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
50 </ItemGroup>
51</Project>
diff --git a/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.v3.ncrunchproject b/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.v3.ncrunchproject
deleted file mode 100644
index 8f3624cb..00000000
--- a/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.v3.ncrunchproject
+++ /dev/null
@@ -1,6 +0,0 @@
1<ProjectConfiguration>
2 <Settings>
3 <CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
4 <HiddenComponentWarnings />
5 </Settings>
6</ProjectConfiguration> \ No newline at end of file
diff --git a/src/WixToolset.Tools.Core/ConsoleMessageListener.cs b/src/wix/ConsoleMessageListener.cs
index 709fb576..709fb576 100644
--- a/src/WixToolset.Tools.Core/ConsoleMessageListener.cs
+++ b/src/wix/ConsoleMessageListener.cs
diff --git a/src/wix/Program.cs b/src/wix/Program.cs
index 7e302078..3293ef05 100644
--- a/src/wix/Program.cs
+++ b/src/wix/Program.cs
@@ -4,6 +4,7 @@ namespace WixToolset.Tools
4{ 4{
5 using System; 5 using System;
6 using System.Runtime.InteropServices; 6 using System.Runtime.InteropServices;
7 using WixToolset.Converters;
7 using WixToolset.Core; 8 using WixToolset.Core;
8 using WixToolset.Data; 9 using WixToolset.Data;
9 using WixToolset.Extensibility; 10 using WixToolset.Extensibility;
@@ -24,7 +25,8 @@ namespace WixToolset.Tools
24 [MTAThread] 25 [MTAThread]
25 public static int Main(string[] args) 26 public static int Main(string[] args)
26 { 27 {
27 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); 28 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider()
29 .AddConverter();
28 30
29 var listener = new ConsoleMessageListener("WIX", "wix.exe"); 31 var listener = new ConsoleMessageListener("WIX", "wix.exe");
30 32
diff --git a/src/wix/app.config b/src/wix/app.config
index 65d3d6c3..081fea2c 100644
--- a/src/wix/app.config
+++ b/src/wix/app.config
@@ -1,10 +1,8 @@
1<?xml version="1.0" encoding="utf-8" ?> 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. --> 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<configuration> 3<configuration>
6 <runtime> 4 <runtime>
7 <loadFromRemoteSources enabled="true"/> 5 <loadFromRemoteSources enabled="true"/>
8 <AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" /> 6 <AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" />
9 </runtime> 7 </runtime>
10</configuration> 8</configuration>
diff --git a/src/wix/wix.csproj b/src/wix/wix.csproj
index 117bbcd9..2507de33 100644
--- a/src/wix/wix.csproj
+++ b/src/wix/wix.csproj
@@ -21,10 +21,7 @@
21 </PropertyGroup> 21 </PropertyGroup>
22 22
23 <ItemGroup> 23 <ItemGroup>
24 <Compile Include="..\WixToolset.Tools.Core\ConsoleMessageListener.cs" Link="ConsoleMessageListener.cs" /> 24 <PackageReference Include="WixToolset.Converters" Version="4.0.*" />
25 </ItemGroup>
26
27 <ItemGroup>
28 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" /> 25 <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" />
29 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" /> 26 <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" />
30 </ItemGroup> 27 </ItemGroup>
diff --git a/src/wix/wix.exe.manifest b/src/wix/wix.exe.manifest
index 49d90508..f35b5534 100644
--- a/src/wix/wix.exe.manifest
+++ b/src/wix/wix.exe.manifest
@@ -1,10 +1,8 @@
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
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. --> 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<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 3<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
6 <assemblyIdentity name="WixToolset.Tools.Wix" version="4.0.0.0" processorArchitecture="x86" type="win32"/> 4 <assemblyIdentity name="WixToolset.Tools.Wix" version="4.0.0.0" processorArchitecture="x86" type="win32"/>
7 <description>WiX Toolset Compiler</description> 5 <description>WiX Toolset Compiler</description>
8 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> 6 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
9 <security> 7 <security>
10 <requestedPrivileges> 8 <requestedPrivileges>
diff --git a/src/wixcop/CommandLine/ConvertCommand.cs b/src/wixcop/CommandLine/ConvertCommand.cs
deleted file mode 100644
index 0a765771..00000000
--- a/src/wixcop/CommandLine/ConvertCommand.cs
+++ /dev/null
@@ -1,224 +0,0 @@
1// 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.
2
3namespace WixToolset.Tools.WixCop.CommandLine
4{
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 using System.Xml;
9 using WixToolset.Converters;
10 using WixToolset.Extensibility.Data;
11 using WixToolset.Extensibility.Services;
12
13 internal class ConvertCommand : ICommandLineCommand
14 {
15 private const string SettingsFileDefault = "wixcop.settings.xml";
16
17 public ConvertCommand(IWixToolsetServiceProvider serviceProvider, bool showLogo, bool fixErrors, int indentationAmount, List<string> searchPatterns, bool subDirectories, string settingsFile1, string settingsFile2)
18 {
19 this.ErrorsAsWarnings = new HashSet<string>();
20 this.ExemptFiles = new HashSet<string>();
21 this.FixErrors = fixErrors;
22 this.IndentationAmount = indentationAmount;
23 this.IgnoreErrors = new HashSet<string>();
24 this.SearchPatternResults = new HashSet<string>();
25 this.SearchPatterns = searchPatterns;
26 this.ServiceProvider = serviceProvider;
27 this.SettingsFile1 = settingsFile1;
28 this.SettingsFile2 = settingsFile2;
29 this.ShowLogo = showLogo;
30 this.SubDirectories = subDirectories;
31 }
32
33 private HashSet<string> ErrorsAsWarnings { get; }
34
35 private HashSet<string> ExemptFiles { get; }
36
37 private bool FixErrors { get; }
38
39 private int IndentationAmount { get; }
40
41 private HashSet<string> IgnoreErrors { get; }
42
43 private HashSet<string> SearchPatternResults { get; }
44
45 private List<string> SearchPatterns { get; }
46
47 private IWixToolsetServiceProvider ServiceProvider { get; }
48
49 private string SettingsFile1 { get; }
50
51 private string SettingsFile2 { get; }
52
53 private bool SubDirectories { get; }
54
55 public bool ShowLogo { get; }
56
57 public bool StopParsing => throw new NotImplementedException();
58
59 public bool TryParseArgument(ICommandLineParser parser, string argument)
60 {
61 throw new NotImplementedException();
62 }
63
64 public int Execute()
65 {
66 // parse the settings if any were specified
67 if (null != this.SettingsFile1 || null != this.SettingsFile2)
68 {
69 this.ParseSettingsFiles(this.SettingsFile1, this.SettingsFile2);
70 }
71 else
72 {
73 if (File.Exists(ConvertCommand.SettingsFileDefault))
74 {
75 this.ParseSettingsFiles(ConvertCommand.SettingsFileDefault, null);
76 }
77 }
78
79 var messaging = this.ServiceProvider.GetService<IMessaging>();
80 var converter = new Wix3Converter(messaging, this.IndentationAmount, this.ErrorsAsWarnings, this.IgnoreErrors);
81
82 var errors = this.InspectSubDirectories(converter, Path.GetFullPath("."));
83
84 foreach (var searchPattern in this.SearchPatterns)
85 {
86 if (!this.SearchPatternResults.Contains(searchPattern))
87 {
88 Console.Error.WriteLine("Could not find file \"{0}\"", searchPattern);
89 errors++;
90 }
91 }
92
93 return errors != 0 ? 2 : 0;
94 }
95
96 /// <summary>
97 /// Get the files that match a search path pattern.
98 /// </summary>
99 /// <param name="baseDir">The base directory at which to begin the search.</param>
100 /// <param name="searchPath">The search path pattern.</param>
101 /// <returns>The files matching the pattern.</returns>
102 private static string[] GetFiles(string baseDir, string searchPath)
103 {
104 // convert alternate directory separators to the standard one
105 var filePath = searchPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
106 var lastSeparator = filePath.LastIndexOf(Path.DirectorySeparatorChar);
107 string[] files = null;
108
109 try
110 {
111 if (0 > lastSeparator)
112 {
113 files = Directory.GetFiles(baseDir, filePath);
114 }
115 else // found directory separator
116 {
117 var searchPattern = filePath.Substring(lastSeparator + 1);
118
119 files = Directory.GetFiles(filePath.Substring(0, lastSeparator + 1), searchPattern);
120 }
121 }
122 catch (DirectoryNotFoundException)
123 {
124 // don't let this function throw the DirectoryNotFoundException. (this exception
125 // occurs for non-existant directories and invalid characters in the searchPattern)
126 }
127
128 return files;
129 }
130
131 /// <summary>
132 /// Inspect sub-directories.
133 /// </summary>
134 /// <param name="directory">The directory whose sub-directories will be inspected.</param>
135 /// <returns>The number of errors that were found.</returns>
136 private int InspectSubDirectories(Wix3Converter converter, string directory)
137 {
138 var errors = 0;
139
140 foreach (var searchPattern in this.SearchPatterns)
141 {
142 foreach (var sourceFilePath in GetFiles(directory, searchPattern))
143 {
144 var file = new FileInfo(sourceFilePath);
145
146 if (!this.ExemptFiles.Contains(file.Name.ToUpperInvariant()))
147 {
148 this.SearchPatternResults.Add(searchPattern);
149 errors += converter.ConvertFile(file.FullName, this.FixErrors);
150 }
151 }
152 }
153
154 if (this.SubDirectories)
155 {
156 foreach (var childDirectoryPath in Directory.GetDirectories(directory))
157 {
158 errors += this.InspectSubDirectories(converter, childDirectoryPath);
159 }
160 }
161
162 return errors;
163 }
164
165 /// <summary>
166 /// Parse the primary and secondary settings files.
167 /// </summary>
168 /// <param name="localSettingsFile1">The primary settings file.</param>
169 /// <param name="localSettingsFile2">The secondary settings file.</param>
170 private void ParseSettingsFiles(string localSettingsFile1, string localSettingsFile2)
171 {
172 if (null == localSettingsFile1 && null != localSettingsFile2)
173 {
174 throw new ArgumentException("Cannot specify a secondary settings file (set2) without a primary settings file (set1).", "localSettingsFile2");
175 }
176
177 var settingsFile = localSettingsFile1;
178 while (null != settingsFile)
179 {
180 XmlTextReader reader = null;
181 try
182 {
183 reader = new XmlTextReader(settingsFile);
184 var doc = new XmlDocument();
185 doc.Load(reader);
186
187 // get the types of tests that will have their errors displayed as warnings
188 var testsIgnoredElements = doc.SelectNodes("/Settings/IgnoreErrors/Test");
189 foreach (XmlElement test in testsIgnoredElements)
190 {
191 var key = test.GetAttribute("Id");
192 this.IgnoreErrors.Add(key);
193 }
194
195 // get the types of tests that will have their errors displayed as warnings
196 var testsAsWarningsElements = doc.SelectNodes("/Settings/ErrorsAsWarnings/Test");
197 foreach (XmlElement test in testsAsWarningsElements)
198 {
199 var key = test.GetAttribute("Id");
200 this.ErrorsAsWarnings.Add(key);
201 }
202
203 // get the exempt files
204 var localExemptFiles = doc.SelectNodes("/Settings/ExemptFiles/File");
205 foreach (XmlElement file in localExemptFiles)
206 {
207 var key = file.GetAttribute("Name").ToUpperInvariant();
208 this.ExemptFiles.Add(key);
209 }
210 }
211 finally
212 {
213 if (null != reader)
214 {
215 reader.Close();
216 }
217 }
218
219 settingsFile = localSettingsFile2;
220 localSettingsFile2 = null;
221 }
222 }
223 }
224}
diff --git a/src/wixcop/CommandLine/HelpCommand.cs b/src/wixcop/CommandLine/HelpCommand.cs
deleted file mode 100644
index 4a173cd9..00000000
--- a/src/wixcop/CommandLine/HelpCommand.cs
+++ /dev/null
@@ -1,37 +0,0 @@
1// 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.
2
3namespace WixToolset.Tools.WixCop.CommandLine
4{
5 using System;
6 using WixToolset.Extensibility.Data;
7 using WixToolset.Extensibility.Services;
8
9 internal class HelpCommand : ICommandLineCommand
10 {
11 public bool ShowLogo => true;
12
13 public bool StopParsing => true;
14
15 public int Execute()
16 {
17 Console.WriteLine(" usage: wixcop.exe sourceFile [sourceFile ...]");
18 Console.WriteLine();
19 Console.WriteLine(" -f fix errors automatically for writable files");
20 Console.WriteLine(" -nologo suppress displaying the logo information");
21 Console.WriteLine(" -s search for matching files in current dir and subdirs");
22 Console.WriteLine(" -set1<file> primary settings file");
23 Console.WriteLine(" -set2<file> secondary settings file (overrides primary)");
24 Console.WriteLine(" -indent:<n> indentation multiple (overrides default of 4)");
25 Console.WriteLine(" -? this help information");
26 Console.WriteLine();
27 Console.WriteLine(" sourceFile may use wildcards like *.wxs");
28
29 return 0;
30 }
31
32 public bool TryParseArgument(ICommandLineParser parser, string argument)
33 {
34 return true;
35 }
36 }
37}
diff --git a/src/wixcop/CommandLine/WixCopCommandLineParser.cs b/src/wixcop/CommandLine/WixCopCommandLineParser.cs
deleted file mode 100644
index f06decee..00000000
--- a/src/wixcop/CommandLine/WixCopCommandLineParser.cs
+++ /dev/null
@@ -1,135 +0,0 @@
1// 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.
2
3namespace WixToolset.Tools.WixCop.CommandLine
4{
5 using System;
6 using System.Collections.Generic;
7 using WixToolset.Core;
8 using WixToolset.Extensibility.Data;
9 using WixToolset.Extensibility.Services;
10 using WixToolset.Tools.WixCop.Interfaces;
11
12 public sealed class WixCopCommandLineParser : IWixCopCommandLineParser
13 {
14 private bool fixErrors;
15 private int indentationAmount;
16 private readonly List<string> searchPatterns;
17 private readonly IWixToolsetServiceProvider serviceProvider;
18 private string settingsFile1;
19 private string settingsFile2;
20 private bool showHelp;
21 private bool showLogo;
22 private bool subDirectories;
23
24 public WixCopCommandLineParser(IWixToolsetServiceProvider serviceProvider)
25 {
26 this.serviceProvider = serviceProvider;
27
28 this.indentationAmount = 4;
29 this.searchPatterns = new List<string>();
30 this.showLogo = true;
31 }
32
33 public ICommandLineArguments Arguments { get; set; }
34
35 public ICommandLineCommand ParseWixCopCommandLine()
36 {
37 this.Parse();
38
39 if (this.showLogo)
40 {
41 AppCommon.DisplayToolHeader();
42 Console.WriteLine();
43 }
44
45 if (this.showHelp)
46 {
47 return new HelpCommand();
48 }
49
50 return new ConvertCommand(
51 this.serviceProvider,
52 this.showLogo,
53 this.fixErrors,
54 this.indentationAmount,
55 this.searchPatterns,
56 this.subDirectories,
57 this.settingsFile1,
58 this.settingsFile2);
59 }
60
61 private void Parse()
62 {
63 this.showHelp = 0 == this.Arguments.Arguments.Length;
64 var parser = this.Arguments.Parse();
65
66 while (!this.showHelp &&
67 String.IsNullOrEmpty(parser.ErrorArgument) &&
68 parser.TryGetNextSwitchOrArgument(out var arg))
69 {
70 if (String.IsNullOrWhiteSpace(arg)) // skip blank arguments.
71 {
72 continue;
73 }
74
75 if (parser.IsSwitch(arg))
76 {
77 if (!this.ParseArgument(parser, arg))
78 {
79 parser.ErrorArgument = arg;
80 }
81 }
82 else
83 {
84 this.searchPatterns.Add(arg);
85 }
86 }
87 }
88
89 private bool ParseArgument(ICommandLineParser parser, string arg)
90 {
91 var parameter = arg.Substring(1);
92
93 switch (parameter.ToLowerInvariant())
94 {
95 case "?":
96 this.showHelp = true;
97 return true;
98 case "f":
99 this.fixErrors = true;
100 return true;
101 case "nologo":
102 this.showLogo = false;
103 return true;
104 case "s":
105 this.subDirectories = true;
106 return true;
107 default: // other parameters
108 if (parameter.StartsWith("set1", StringComparison.Ordinal))
109 {
110 this.settingsFile1 = parameter.Substring(4);
111 }
112 else if (parameter.StartsWith("set2", StringComparison.Ordinal))
113 {
114 this.settingsFile2 = parameter.Substring(4);
115 }
116 else if (parameter.StartsWith("indent:", StringComparison.Ordinal))
117 {
118 try
119 {
120 this.indentationAmount = Convert.ToInt32(parameter.Substring(7));
121 }
122 catch
123 {
124 throw new ArgumentException("Invalid numeric argument.", parameter);
125 }
126 }
127 else
128 {
129 throw new ArgumentException("Invalid argument.", parameter);
130 }
131 return true;
132 }
133 }
134 }
135}
diff --git a/src/wixcop/Interfaces/IWixCopCommandLineParser.cs b/src/wixcop/Interfaces/IWixCopCommandLineParser.cs
deleted file mode 100644
index 44c75289..00000000
--- a/src/wixcop/Interfaces/IWixCopCommandLineParser.cs
+++ /dev/null
@@ -1,13 +0,0 @@
1// 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.
2
3namespace WixToolset.Tools.WixCop.Interfaces
4{
5 using WixToolset.Extensibility.Data;
6
7 public interface IWixCopCommandLineParser
8 {
9 ICommandLineArguments Arguments { get; set; }
10
11 ICommandLineCommand ParseWixCopCommandLine();
12 }
13}
diff --git a/src/wixcop/Program.cs b/src/wixcop/Program.cs
deleted file mode 100644
index 5e72f8ea..00000000
--- a/src/wixcop/Program.cs
+++ /dev/null
@@ -1,79 +0,0 @@
1// 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.
2
3namespace WixToolset.Tools.WixCop
4{
5 using System;
6 using System.Diagnostics;
7 using WixToolset.Core;
8 using WixToolset.Extensibility;
9 using WixToolset.Extensibility.Data;
10 using WixToolset.Extensibility.Services;
11 using WixToolset.Tools.Core;
12 using WixToolset.Tools.WixCop.CommandLine;
13 using WixToolset.Tools.WixCop.Interfaces;
14
15 /// <summary>
16 /// Wix source code style inspector and converter.
17 /// </summary>
18 public sealed class Program
19 {
20 /// <summary>
21 /// The main entry point for the application.
22 /// </summary>
23 /// <param name="args">The commandline arguments.</param>
24 /// <returns>The number of errors that were found.</returns>
25 [STAThread]
26 public static int Main(string[] args)
27 {
28 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider();
29 var listener = new ConsoleMessageListener("WXCP", "wixcop.exe");
30
31 serviceProvider.AddService<IMessageListener>((x, y) => listener);
32 serviceProvider.AddService<IWixCopCommandLineParser>((x, y) => new WixCopCommandLineParser(x));
33
34 var program = new Program();
35 return program.Run(serviceProvider, args);
36 }
37
38 /// <summary>
39 /// Run the application with the given arguments.
40 /// </summary>
41 /// <param name="serviceProvider">Service provider to use throughout this execution.</param>
42 /// <param name="args">The commandline arguments.</param>
43 /// <returns>The number of errors that were found.</returns>
44 public int Run(IWixToolsetServiceProvider serviceProvider, string[] args)
45 {
46 try
47 {
48 var listener = serviceProvider.GetService<IMessageListener>();
49 var messaging = serviceProvider.GetService<IMessaging>();
50 messaging.SetListener(listener);
51
52 var arguments = serviceProvider.GetService<ICommandLineArguments>();
53 arguments.Populate(args);
54
55 var commandLine = serviceProvider.GetService<IWixCopCommandLineParser>();
56 commandLine.Arguments = arguments;
57 var command = commandLine.ParseWixCopCommandLine();
58
59 if (command.ShowLogo)
60 {
61 var wixcopAssembly = this.GetType().Assembly;
62 var fv = FileVersionInfo.GetVersionInfo(wixcopAssembly.Location);
63
64 Console.WriteLine("WiX Cop version {0}", fv.FileVersion);
65 Console.WriteLine("Copyright (C) .NET Foundation and contributors. All rights reserved.");
66 Console.WriteLine();
67 }
68
69 return command?.Execute() ?? 1;
70 }
71 catch (Exception e)
72 {
73 Console.Error.WriteLine("wixcop.exe : fatal error WXCP0001 : {0}\r\n\n\nStack Trace:\r\n{1}", e.Message, e.StackTrace);
74
75 return 1;
76 }
77 }
78 }
79}
diff --git a/src/wixcop/WixCop.csproj b/src/wixcop/WixCop.csproj
deleted file mode 100644
index 13a188ab..00000000
--- a/src/wixcop/WixCop.csproj
+++ /dev/null
@@ -1,35 +0,0 @@
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<Project Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup>
6 <TargetFrameworks>netcoreapp2.1;net461;net472</TargetFrameworks>
7 <OutputType>Exe</OutputType>
8 <Description>Converter</Description>
9 <Title>WiX Error Correction Tool</Title>
10 <DebugType>embedded</DebugType>
11 <PublishRepositoryUrl>true</PublishRepositoryUrl>
12 <!-- <PackAsTool>true</PackAsTool> -->
13 <RuntimeIdentifier Condition=" '$(RuntimeIdentifier)'=='' and '$(TargetFramework)'!='netcoreapp2.1' ">win-x86</RuntimeIdentifier>
14 <AppConfig>app.config</AppConfig>
15 <ApplicationManifest>wixcop.exe.manifest</ApplicationManifest>
16 <RollForward>Major</RollForward>
17 </PropertyGroup>
18
19 <PropertyGroup>
20 <NoWarn>NU1701</NoWarn>
21 </PropertyGroup>
22
23 <ItemGroup>
24 <Compile Include="..\WixToolset.Tools.Core\ConsoleMessageListener.cs" Link="ConsoleMessageListener.cs" />
25 </ItemGroup>
26
27 <ItemGroup>
28 <PackageReference Include="WixToolset.Converters" Version="4.0.*" />
29 </ItemGroup>
30
31 <ItemGroup>
32 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
33 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="All" />
34 </ItemGroup>
35</Project>
diff --git a/src/wixcop/WixCop.net461.v3.ncrunchproject b/src/wixcop/WixCop.net461.v3.ncrunchproject
deleted file mode 100644
index cf22dfa9..00000000
--- a/src/wixcop/WixCop.net461.v3.ncrunchproject
+++ /dev/null
@@ -1,5 +0,0 @@
1<ProjectConfiguration>
2 <Settings>
3 <HiddenComponentWarnings />
4 </Settings>
5</ProjectConfiguration> \ No newline at end of file
diff --git a/src/wixcop/WixCop.netcoreapp2.1.v3.ncrunchproject b/src/wixcop/WixCop.netcoreapp2.1.v3.ncrunchproject
deleted file mode 100644
index cf22dfa9..00000000
--- a/src/wixcop/WixCop.netcoreapp2.1.v3.ncrunchproject
+++ /dev/null
@@ -1,5 +0,0 @@
1<ProjectConfiguration>
2 <Settings>
3 <HiddenComponentWarnings />
4 </Settings>
5</ProjectConfiguration> \ No newline at end of file
diff --git a/src/wixcop/app.config b/src/wixcop/app.config
deleted file mode 100644
index 65d3d6c3..00000000
--- a/src/wixcop/app.config
+++ /dev/null
@@ -1,10 +0,0 @@
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<configuration>
6 <runtime>
7 <loadFromRemoteSources enabled="true"/>
8 <AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" />
9 </runtime>
10</configuration>
diff --git a/src/wixcop/wixcop.exe.manifest b/src/wixcop/wixcop.exe.manifest
deleted file mode 100644
index bf4a93b0..00000000
--- a/src/wixcop/wixcop.exe.manifest
+++ /dev/null
@@ -1,20 +0,0 @@
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
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<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
6 <assemblyIdentity name="WixToolset.Tools.WixCop" version="4.0.0.0" processorArchitecture="x86" type="win32"/>
7 <description>WiX Toolset Correction Tool</description>
8 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
9 <security>
10 <requestedPrivileges>
11 <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
12 </requestedPrivileges>
13 </security>
14 </trustInfo>
15 <application xmlns="urn:schemas-microsoft-com:asm.v3">
16 <windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
17 <ws2:longPathAware>true</ws2:longPathAware>
18 </windowsSettings>
19 </application>
20</assembly>