aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2019-05-15 16:09:26 -0700
committerRob Mensching <rob@firegiant.com>2019-05-15 16:12:21 -0700
commit6f6c485118796f044a278447722eaf18ac5bf86e (patch)
treede580265227abc257ee85a8973367f5cdce09bd9 /src/test
parent8d3f778c61a1a0a576445e8dc7312613363b787d (diff)
downloadwix-6f6c485118796f044a278447722eaf18ac5bf86e.tar.gz
wix-6f6c485118796f044a278447722eaf18ac5bf86e.tar.bz2
wix-6f6c485118796f044a278447722eaf18ac5bf86e.zip
Initial code commit
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs391
-rw-r--r--src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wixoutbin0 -> 148559 bytes
-rw-r--r--src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wixproj47
-rw-r--r--src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wxs36
-rw-r--r--src/test/WixToolsetTest.Converters.Tupleizer/WixToolsetTest.Converters.Tupleizer.csproj33
-rw-r--r--src/test/WixToolsetTest.Converters/ConverterFixture.cs554
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs62
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs63
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml9
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs65
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs64
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs64
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs63
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs60
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs61
-rw-r--r--src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj39
16 files changed, 1611 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs b/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs
new file mode 100644
index 00000000..ae33d6b1
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs
@@ -0,0 +1,391 @@
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.Converters.Tupleizer
4{
5 using System;
6 using System.IO;
7 using System.Linq;
8 using WixBuildTools.TestSupport;
9 using Wix3 = Microsoft.Tools.WindowsInstallerXml;
10 using WixToolset.Converters.Tupleizer;
11 using WixToolset.Data;
12 using WixToolset.Data.WindowsInstaller;
13 using WixToolset.Data.Tuples;
14 using Xunit;
15
16 public class ConvertTuplesFixture
17 {
18 [Fact]
19 public void CanLoadWixoutAndConvertToIntermediate()
20 {
21 var rootFolder = TestData.Get();
22 var dataFolder = TestData.Get(@"TestData\Integration");
23
24 using (var fs = new DisposableFileSystem())
25 {
26 var intermediateFolder = fs.GetFolder();
27
28 var path = Path.Combine(dataFolder, "test.wixout");
29 var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true);
30
31 var command = new ConvertTuplesCommand();
32 var intermediate = command.Execute(output);
33
34 Assert.NotNull(intermediate);
35 Assert.Single(intermediate.Sections);
36 Assert.Equal(String.Empty, intermediate.Id);
37
38 // Save and load to guarantee round-tripping support.
39 //
40 var wixiplFile = Path.Combine(intermediateFolder, "test.wixipl");
41 intermediate.Save(wixiplFile);
42
43 intermediate = Intermediate.Load(wixiplFile);
44
45 // Dump to text for easy diffing, with some massaging to keep v3 and v4 diffable.
46 //
47 var tables = output.Tables.Cast<Wix3.Table>();
48 var wix3Dump = tables
49 .SelectMany(table => table.Rows.Cast<Wix3.Row>()
50 .Select(row => RowToString(row)))
51 .ToArray();
52
53 var tuples = intermediate.Sections.SelectMany(s => s.Tuples);
54 var wix4Dump = tuples.Select(tuple => TupleToString(tuple)).ToArray();
55
56 Assert.Equal(wix3Dump, wix4Dump);
57
58 // Useful when you want to diff the outputs with another diff tool...
59 //
60 //var wix3TextDump = String.Join(Environment.NewLine, wix3Dump.OrderBy(val => val));
61 //var wix4TextDump = String.Join(Environment.NewLine, wix4Dump.OrderBy(val => val));
62 //Assert.Equal(wix3TextDump, wix4TextDump);
63 }
64 }
65
66 private static string RowToString(Wix3.Row row)
67 {
68 var fields = String.Join(",", row.Fields.Select(field => field.Data?.ToString()));
69
70 // Massage output to match WiX v3 rows and v4 tuples.
71 //
72 switch (row.Table.Name)
73 {
74 case "File":
75 var fieldValues = row.Fields.Take(7).Select(field => field.Data?.ToString()).ToArray();
76 if (fieldValues[3] == null)
77 {
78 // "Somebody" sometimes writes out a null field even when the column definition says
79 // it's non-nullable. Not naming names or anything. (SWID tags.)
80 fieldValues[3] = "0";
81 }
82 fields = String.Join(",", fieldValues);
83 break;
84 case "WixFile":
85 fields = String.Join(",", row.Fields.Take(8).Select(field => field.Data?.ToString()));
86 break;
87 }
88
89 return $"{row.Table.Name},{fields}";
90 }
91
92 private static string TupleToString(WixToolset.Data.IntermediateTuple tuple)
93 {
94 var fields = String.Join(",", tuple.Fields.Select(field => field?.AsString()));
95
96 switch (tuple.Definition.Name)
97 {
98 // Massage output to match WiX v3 rows and v4 tuples.
99 //
100 case "Component":
101 {
102 var componentTuple = (ComponentTuple)tuple;
103 var attributes = ComponentLocation.Either == componentTuple.Location ? WindowsInstallerConstants.MsidbComponentAttributesOptional : 0;
104 attributes |= ComponentLocation.SourceOnly == componentTuple.Location ? WindowsInstallerConstants.MsidbComponentAttributesSourceOnly : 0;
105 attributes |= ComponentKeyPathType.Registry == componentTuple.KeyPathType ? WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath : 0;
106 attributes |= ComponentKeyPathType.OdbcDataSource == componentTuple.KeyPathType ? WindowsInstallerConstants.MsidbComponentAttributesODBCDataSource : 0;
107 attributes |= componentTuple.DisableRegistryReflection ? WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection : 0;
108 attributes |= componentTuple.NeverOverwrite ? WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite : 0;
109 attributes |= componentTuple.Permanent ? WindowsInstallerConstants.MsidbComponentAttributesPermanent : 0;
110 attributes |= componentTuple.SharedDllRefCount ? WindowsInstallerConstants.MsidbComponentAttributesSharedDllRefCount : 0;
111 attributes |= componentTuple.Shared ? WindowsInstallerConstants.MsidbComponentAttributesShared : 0;
112 attributes |= componentTuple.Transitive ? WindowsInstallerConstants.MsidbComponentAttributesTransitive : 0;
113 attributes |= componentTuple.UninstallWhenSuperseded ? WindowsInstallerConstants.MsidbComponentAttributes64bit : 0;
114 attributes |= componentTuple.Win64 ? WindowsInstallerConstants.MsidbComponentAttributes64bit : 0;
115
116 fields = String.Join(",",
117 componentTuple.ComponentId,
118 componentTuple.Directory_,
119 attributes.ToString(),
120 componentTuple.Condition,
121 componentTuple.KeyPath
122 );
123 break;
124 }
125 case "CustomAction":
126 {
127 var customActionTuple = (CustomActionTuple)tuple;
128 var type = customActionTuple.Win64 ? WindowsInstallerConstants.MsidbCustomActionType64BitScript : 0;
129 type |= customActionTuple.TSAware ? WindowsInstallerConstants.MsidbCustomActionTypeTSAware : 0;
130 type |= customActionTuple.Impersonate ? 0 : WindowsInstallerConstants.MsidbCustomActionTypeNoImpersonate;
131 type |= customActionTuple.IgnoreResult ? WindowsInstallerConstants.MsidbCustomActionTypeContinue : 0;
132 type |= customActionTuple.Hidden ? WindowsInstallerConstants.MsidbCustomActionTypeHideTarget : 0;
133 type |= customActionTuple.Async ? WindowsInstallerConstants.MsidbCustomActionTypeAsync : 0;
134 type |= CustomActionExecutionType.FirstSequence == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeFirstSequence : 0;
135 type |= CustomActionExecutionType.OncePerProcess == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeOncePerProcess : 0;
136 type |= CustomActionExecutionType.ClientRepeat == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeClientRepeat : 0;
137 type |= CustomActionExecutionType.Deferred == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript : 0;
138 type |= CustomActionExecutionType.Rollback == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript | WindowsInstallerConstants.MsidbCustomActionTypeRollback : 0;
139 type |= CustomActionExecutionType.Commit == customActionTuple.ExecutionType ? WindowsInstallerConstants.MsidbCustomActionTypeInScript | WindowsInstallerConstants.MsidbCustomActionTypeCommit : 0;
140 type |= CustomActionSourceType.File == customActionTuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeSourceFile : 0;
141 type |= CustomActionSourceType.Directory == customActionTuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeDirectory : 0;
142 type |= CustomActionSourceType.Property == customActionTuple.SourceType ? WindowsInstallerConstants.MsidbCustomActionTypeProperty : 0;
143 type |= CustomActionTargetType.Dll == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeDll : 0;
144 type |= CustomActionTargetType.Exe == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeExe : 0;
145 type |= CustomActionTargetType.TextData == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeTextData : 0;
146 type |= CustomActionTargetType.JScript == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeJScript : 0;
147 type |= CustomActionTargetType.VBScript == customActionTuple.TargetType ? WindowsInstallerConstants.MsidbCustomActionTypeVBScript : 0;
148
149 fields = String.Join(",",
150 type.ToString(),
151 customActionTuple.Source,
152 customActionTuple.Target,
153 customActionTuple.PatchUninstall ? WindowsInstallerConstants.MsidbCustomActionTypePatchUninstall.ToString() : null
154 );
155 break;
156 }
157 case "Feature":
158 {
159 var featureTuple = (FeatureTuple)tuple;
160 var attributes = featureTuple.DisallowAbsent ? WindowsInstallerConstants.MsidbFeatureAttributesUIDisallowAbsent : 0;
161 attributes |= featureTuple.DisallowAdvertise ? WindowsInstallerConstants.MsidbFeatureAttributesDisallowAdvertise : 0;
162 attributes |= FeatureInstallDefault.FollowParent == featureTuple.InstallDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFollowParent : 0;
163 attributes |= FeatureInstallDefault.Source == featureTuple.InstallDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFavorSource : 0;
164 attributes |= FeatureTypicalDefault.Advertise == featureTuple.TypicalDefault ? WindowsInstallerConstants.MsidbFeatureAttributesFavorAdvertise : 0;
165
166 fields = String.Join(",",
167 featureTuple.Feature_Parent,
168 featureTuple.Title,
169 featureTuple.Description,
170 featureTuple.Display.ToString(),
171 featureTuple.Level.ToString(),
172 featureTuple.Directory_,
173 attributes.ToString());
174 break;
175 }
176 case "File":
177 {
178 var fileTuple = (FileTuple)tuple;
179 fields = String.Join(",",
180 fileTuple.Component_,
181 fileTuple.LongFileName,
182 fileTuple.FileSize.ToString(),
183 fileTuple.Version,
184 fileTuple.Language,
185 ((fileTuple.ReadOnly ? WindowsInstallerConstants.MsidbFileAttributesReadOnly : 0)
186 | (fileTuple.Hidden ? WindowsInstallerConstants.MsidbFileAttributesHidden : 0)
187 | (fileTuple.System ? WindowsInstallerConstants.MsidbFileAttributesSystem : 0)
188 | (fileTuple.Vital ? WindowsInstallerConstants.MsidbFileAttributesVital : 0)
189 | (fileTuple.Checksum ? WindowsInstallerConstants.MsidbFileAttributesChecksum : 0)
190 | ((fileTuple.Compressed.HasValue && fileTuple.Compressed.Value) ? WindowsInstallerConstants.MsidbFileAttributesCompressed : 0)
191 | ((fileTuple.Compressed.HasValue && !fileTuple.Compressed.Value) ? WindowsInstallerConstants.MsidbFileAttributesNoncompressed : 0))
192 .ToString());
193 break;
194 }
195
196 case "Registry":
197 {
198 var registryTuple = (RegistryTuple)tuple;
199 var value = registryTuple.Value;
200
201 switch (registryTuple.ValueType)
202 {
203 case RegistryValueType.Binary:
204 value = String.Concat("#x", value);
205 break;
206 case RegistryValueType.Expandable:
207 value = String.Concat("#%", value);
208 break;
209 case RegistryValueType.Integer:
210 value = String.Concat("#", value);
211 break;
212 case RegistryValueType.MultiString:
213 switch (registryTuple.ValueAction)
214 {
215 case RegistryValueActionType.Append:
216 value = String.Concat("[~]", value);
217 break;
218 case RegistryValueActionType.Prepend:
219 value = String.Concat(value, "[~]");
220 break;
221 case RegistryValueActionType.Write:
222 default:
223 if (null != value && -1 == value.IndexOf("[~]", StringComparison.Ordinal))
224 {
225 value = String.Concat("[~]", value, "[~]");
226 }
227 break;
228 }
229 break;
230 case RegistryValueType.String:
231 // escape the leading '#' character for string registry keys
232 if (null != value && value.StartsWith("#", StringComparison.Ordinal))
233 {
234 value = String.Concat("#", value);
235 }
236 break;
237 }
238
239 fields = String.Join(",",
240 ((int)registryTuple.Root).ToString(),
241 registryTuple.Key,
242 registryTuple.Name,
243 value,
244 registryTuple.Component_
245 );
246 break;
247 }
248
249 case "RemoveRegistry":
250 {
251 var removeRegistryTuple = (RemoveRegistryTuple)tuple;
252 fields = String.Join(",",
253 ((int)removeRegistryTuple.Root).ToString(),
254 removeRegistryTuple.Key,
255 removeRegistryTuple.Name,
256 removeRegistryTuple.Component_
257 );
258 break;
259 }
260
261 case "ServiceControl":
262 {
263 var serviceControlTuple = (ServiceControlTuple)tuple;
264
265 var events = serviceControlTuple.InstallRemove ? WindowsInstallerConstants.MsidbServiceControlEventDelete : 0;
266 events |= serviceControlTuple.UninstallRemove ? WindowsInstallerConstants.MsidbServiceControlEventUninstallDelete : 0;
267 events |= serviceControlTuple.InstallStart ? WindowsInstallerConstants.MsidbServiceControlEventStart : 0;
268 events |= serviceControlTuple.UninstallStart ? WindowsInstallerConstants.MsidbServiceControlEventUninstallStart : 0;
269 events |= serviceControlTuple.InstallStop ? WindowsInstallerConstants.MsidbServiceControlEventStop : 0;
270 events |= serviceControlTuple.UninstallStop ? WindowsInstallerConstants.MsidbServiceControlEventUninstallStop : 0;
271
272 fields = String.Join(",",
273 serviceControlTuple.Name,
274 events.ToString(),
275 serviceControlTuple.Arguments,
276 serviceControlTuple.Wait == true ? "1" : "0",
277 serviceControlTuple.Component_
278 );
279 break;
280 }
281
282 case "ServiceInstall":
283 {
284 var serviceInstallTuple = (ServiceInstallTuple)tuple;
285
286 var errorControl = (int)serviceInstallTuple.ErrorControl;
287 errorControl |= serviceInstallTuple.Vital ? WindowsInstallerConstants.MsidbServiceInstallErrorControlVital : 0;
288
289 var serviceType = (int)serviceInstallTuple.ServiceType;
290 serviceType |= serviceInstallTuple.Interactive ? WindowsInstallerConstants.MsidbServiceInstallInteractive : 0;
291
292 fields = String.Join(",",
293 serviceInstallTuple.Name,
294 serviceInstallTuple.DisplayName,
295 serviceType.ToString(),
296 ((int)serviceInstallTuple.StartType).ToString(),
297 errorControl.ToString(),
298 serviceInstallTuple.LoadOrderGroup,
299 serviceInstallTuple.Dependencies,
300 serviceInstallTuple.StartName,
301 serviceInstallTuple.Password,
302 serviceInstallTuple.Arguments,
303 serviceInstallTuple.Component_,
304 serviceInstallTuple.Description
305 );
306 break;
307 }
308
309 case "Upgrade":
310 {
311 var upgradeTuple = (UpgradeTuple)tuple;
312
313 var attributes = upgradeTuple.MigrateFeatures ? WindowsInstallerConstants.MsidbUpgradeAttributesMigrateFeatures : 0;
314 attributes |= upgradeTuple.OnlyDetect ? WindowsInstallerConstants.MsidbUpgradeAttributesOnlyDetect : 0;
315 attributes |= upgradeTuple.IgnoreRemoveFailures ? WindowsInstallerConstants.MsidbUpgradeAttributesIgnoreRemoveFailure : 0;
316 attributes |= upgradeTuple.VersionMinInclusive ? WindowsInstallerConstants.MsidbUpgradeAttributesVersionMinInclusive : 0;
317 attributes |= upgradeTuple.VersionMaxInclusive ? WindowsInstallerConstants.MsidbUpgradeAttributesVersionMaxInclusive : 0;
318 attributes |= upgradeTuple.ExcludeLanguages ? WindowsInstallerConstants.MsidbUpgradeAttributesLanguagesExclusive : 0;
319
320 fields = String.Join(",",
321 upgradeTuple.VersionMin,
322 upgradeTuple.VersionMax,
323 upgradeTuple.Language,
324 attributes.ToString(),
325 upgradeTuple.Remove,
326 upgradeTuple.ActionProperty
327 );
328 break;
329 }
330
331 case "WixAction":
332 {
333 var wixActionTuple = (WixActionTuple)tuple;
334 fields = String.Join(",",
335 wixActionTuple.SequenceTable,
336 wixActionTuple.Action,
337 wixActionTuple.Condition,
338 // BUGBUGBUG: AB#2626
339 wixActionTuple.Sequence == 0 ? String.Empty : wixActionTuple.Sequence.ToString(),
340 wixActionTuple.Before,
341 wixActionTuple.After,
342 wixActionTuple.Overridable == true ? "1" : "0"
343 );
344 break;
345 }
346
347 case "WixComplexReference":
348 {
349 var wixComplexReferenceTuple = (WixComplexReferenceTuple)tuple;
350 fields = String.Join(",",
351 wixComplexReferenceTuple.Parent,
352 ((int)wixComplexReferenceTuple.ParentType).ToString(),
353 wixComplexReferenceTuple.ParentLanguage,
354 wixComplexReferenceTuple.Child,
355 ((int)wixComplexReferenceTuple.ChildType).ToString(),
356 wixComplexReferenceTuple.IsPrimary ? "1" : "0"
357 );
358 break;
359 }
360
361 case "WixFile":
362 {
363 var wixFileTuple = (WixFileTuple)tuple;
364 fields = String.Concat(
365 wixFileTuple.AssemblyType == FileAssemblyType.DotNetAssembly ? "0" : wixFileTuple.AssemblyType == FileAssemblyType.Win32Assembly ? "1" : String.Empty, ",",
366 String.Join(",", tuple.Fields.Skip(2).Take(6).Select(field => (string)field).ToArray()));
367 break;
368 }
369
370 case "WixProperty":
371 {
372 var wixPropertyTuple = (WixPropertyTuple)tuple;
373 var attributes = 0;
374 attributes |= wixPropertyTuple.Admin ? 0x1 : 0;
375 attributes |= wixPropertyTuple.Hidden ? 0x2 : 0;
376 attributes |= wixPropertyTuple.Secure ? 0x4 : 0;
377
378 fields = String.Join(",",
379 wixPropertyTuple.Property_,
380 attributes.ToString()
381 );
382 break;
383 }
384
385 }
386
387 var id = tuple.Id == null ? String.Empty : String.Concat(",", tuple.Id.Id);
388 return $"{tuple.Definition.Name}{id},{fields}";
389 }
390 }
391}
diff --git a/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wixout b/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wixout
new file mode 100644
index 00000000..da64b8af
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wixout
Binary files differ
diff --git a/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wixproj b/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wixproj
new file mode 100644
index 00000000..8af13dc8
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wixproj
@@ -0,0 +1,47 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6 <ProductVersion>3.10</ProductVersion>
7 <ProjectGuid>d59f1c1e-9238-49fa-bfa2-ec1d9c2dda1d</ProjectGuid>
8 <SchemaVersion>2.0</SchemaVersion>
9 <OutputName>TupleizerWixout</OutputName>
10 <OutputType>Package</OutputType>
11 </PropertyGroup>
12 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
13 <OutputPath>bin\$(Configuration)\</OutputPath>
14 <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
15 <DefineConstants>Debug</DefineConstants>
16 </PropertyGroup>
17 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
18 <OutputPath>bin\$(Configuration)\</OutputPath>
19 <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
20 </PropertyGroup>
21 <ItemGroup>
22 <Compile Include="Product.wxs" />
23 </ItemGroup>
24 <ItemGroup>
25 <WixExtension Include="WixUtilExtension">
26 <HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
27 <Name>WixUtilExtension</Name>
28 </WixExtension>
29 <WixExtension Include="WixNetFxExtension">
30 <HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
31 <Name>WixNetFxExtension</Name>
32 </WixExtension>
33 </ItemGroup>
34 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
35 <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
36 <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
37 <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
38 </Target>
39 <!--
40 To modify your build process, add your task inside one of the targets below and uncomment it.
41 Other similar extension points exist, see Wix.targets.
42 <Target Name="BeforeBuild">
43 </Target>
44 <Target Name="AfterBuild">
45 </Target>
46 -->
47</Project> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wxs b/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wxs
new file mode 100644
index 00000000..1006a254
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters.Tupleizer/TestData/Integration/test.wxs
@@ -0,0 +1,36 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3 <Product Id="*" Name="TupleizerWixout" Language="1033" Version="1.0.0.0" Manufacturer="FireGiant" UpgradeCode="14a02d7f-9b32-4c92-b1f1-da518bf4e32a">
4 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
5
6 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" IgnoreRemoveFailure="yes" />
7 <MediaTemplate />
8
9 <Feature Id="ProductFeature" Title="TupleizerWixout" Level="1">
10 <Feature Id="ChildFeature">
11 <ComponentGroupRef Id="ProductComponents" />
12 </Feature>
13 </Feature>
14
15 <PropertyRef Id="WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED" />
16 <CustomActionRef Id="WixFailWhenDeferred" />
17 <Property Id="WIXFAILWHENDEFERRED" Value="1" Secure="yes" />
18 </Product>
19
20 <Fragment>
21 <Directory Id="TARGETDIR" Name="SourceDir">
22 <Directory Id="ProgramFilesFolder">
23 <Directory Id="INSTALLFOLDER" Name="TupleizerWixout" />
24 </Directory>
25 </Directory>
26 </Fragment>
27
28 <Fragment>
29 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
30 <Component Id="ProductComponent">
31 <File Checksum="yes" ReadOnly="yes" Source="$(env.WIX)\bin\candle.exe" Assembly=".net" AssemblyApplication="candle.exe" />
32 <RegistryValue Root="HKLM" Key="SOFTWARE\WiX Toolset" Name="[ProductName]Installed" Value="1" Type="integer" />
33 </Component>
34 </ComponentGroup>
35 </Fragment>
36</Wix>
diff --git a/src/test/WixToolsetTest.Converters.Tupleizer/WixToolsetTest.Converters.Tupleizer.csproj b/src/test/WixToolsetTest.Converters.Tupleizer/WixToolsetTest.Converters.Tupleizer.csproj
new file mode 100644
index 00000000..fa6a6bcf
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters.Tupleizer/WixToolsetTest.Converters.Tupleizer.csproj
@@ -0,0 +1,33 @@
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
6 <PropertyGroup>
7 <TargetFramework>net461</TargetFramework>
8 <IsPackable>false</IsPackable>
9 </PropertyGroup>
10
11 <ItemGroup>
12 <Content Include="TestData\Integration\test.wixout" CopyToOutputDirectory="PreserveNewest" />
13 </ItemGroup>
14
15 <ItemGroup>
16 <ProjectReference Include="..\..\WixToolset.Converters.Tupleizer\WixToolset.Converters.Tupleizer.csproj" />
17 </ItemGroup>
18
19 <ItemGroup>
20 <PackageReference Include="WixToolset.Data" Version="4.0.*" />
21 <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
22 </ItemGroup>
23
24 <ItemGroup>
25 <Reference Include="wix" HintPath="..\..\deps\wix.dll" />
26 </ItemGroup>
27
28 <ItemGroup>
29 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
30 <PackageReference Include="xunit" Version="2.4.1" />
31 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
32 </ItemGroup>
33</Project>
diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs
new file mode 100644
index 00000000..97769cd6
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/ConverterFixture.cs
@@ -0,0 +1,554 @@
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.Converters
4{
5 using System;
6 using System.IO;
7 using System.Text;
8 using System.Xml.Linq;
9 using WixToolset.Converters;
10 using WixToolset.Data;
11 using WixToolset.Extensibility;
12 using WixToolset.Extensibility.Services;
13 using Xunit;
14
15 public class ConverterFixture
16 {
17 private static readonly XNamespace Wix4Namespace = "http://wixtoolset.org/schemas/v4/wxs";
18
19 [Fact]
20 public void EnsuresDeclaration()
21 {
22 var parse = String.Join(Environment.NewLine,
23 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
24 " <Fragment />",
25 "</Wix>");
26
27 var expected = String.Join(Environment.NewLine,
28 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
29 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
30 " <Fragment />",
31 "</Wix>");
32
33 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
34
35 var messaging = new DummyMessaging();
36 var converter = new Wix3Converter(messaging, 2, null, null);
37
38 var errors = converter.ConvertDocument(document);
39
40 var actual = UnformattedDocumentString(document);
41
42 Assert.Equal(1, errors);
43 Assert.Equal(expected, actual);
44 }
45
46 [Fact]
47 public void EnsuresUtf8Declaration()
48 {
49 var parse = String.Join(Environment.NewLine,
50 "<?xml version='1.0'?>",
51 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
52 " <Fragment />",
53 "</Wix>");
54
55 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
56
57 var messaging = new DummyMessaging();
58 var converter = new Wix3Converter(messaging, 4, null, null);
59
60 var errors = converter.ConvertDocument(document);
61
62 Assert.Equal(1, errors);
63 Assert.Equal("1.0", document.Declaration.Version);
64 Assert.Equal("utf-8", document.Declaration.Encoding);
65 }
66
67 [Fact]
68 public void CanFixWhitespace()
69 {
70 var parse = String.Join(Environment.NewLine,
71 "<?xml version='1.0' encoding='utf-8'?>",
72 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
73 " <Fragment>",
74 " <Property Id='Prop'",
75 " Value='Val'>",
76 " </Property>",
77 " </Fragment>",
78 "</Wix>");
79
80 var expected = String.Join(Environment.NewLine,
81 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
82 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
83 " <Fragment>",
84 " <Property Id=\"Prop\" Value=\"Val\" />",
85 " </Fragment>",
86 "</Wix>");
87
88 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
89
90 var messaging = new DummyMessaging();
91 var converter = new Wix3Converter(messaging, 4, null, null);
92
93 var errors = converter.ConvertDocument(document);
94
95 var actual = UnformattedDocumentString(document);
96
97 Assert.Equal(expected, actual);
98 Assert.Equal(4, errors);
99 }
100
101 [Fact]
102 public void CanPreserveNewLines()
103 {
104 var parse = String.Join(Environment.NewLine,
105 "<?xml version='1.0' encoding='utf-8'?>",
106 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
107 " <Fragment>",
108 "",
109 " <Property Id='Prop' Value='Val' />",
110 "",
111 " </Fragment>",
112 "</Wix>");
113
114 var expected = String.Join(Environment.NewLine,
115 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
116 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
117 " <Fragment>",
118 "",
119 " <Property Id=\"Prop\" Value=\"Val\" />",
120 "",
121 " </Fragment>",
122 "</Wix>");
123
124 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
125
126 var messaging = new DummyMessaging();
127 var converter = new Wix3Converter(messaging, 4, null, null);
128
129 var conversions = converter.ConvertDocument(document);
130
131 var actual = UnformattedDocumentString(document);
132
133 Assert.Equal(expected, actual);
134 Assert.Equal(3, conversions);
135 }
136
137 [Fact]
138 public void CanConvertWithNewLineAtEndOfFile()
139 {
140 var parse = String.Join(Environment.NewLine,
141 "<?xml version='1.0' encoding='utf-8'?>",
142 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
143 " <Fragment>",
144 "",
145 " <Property Id='Prop' Value='Val' />",
146 "",
147 " </Fragment>",
148 "</Wix>",
149 "");
150
151 var expected = String.Join(Environment.NewLine,
152 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
153 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
154 " <Fragment>",
155 "",
156 " <Property Id=\"Prop\" Value=\"Val\" />",
157 "",
158 " </Fragment>",
159 "</Wix>",
160 "");
161
162 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
163
164 var messaging = new DummyMessaging();
165 var converter = new Wix3Converter(messaging, 4, null, null);
166
167 var conversions = converter.ConvertDocument(document);
168
169 var actual = UnformattedDocumentString(document);
170
171 Assert.Equal(expected, actual);
172 Assert.Equal(3, conversions);
173 }
174
175 [Fact]
176 public void CanFixCdataWhitespace()
177 {
178 var parse = String.Join(Environment.NewLine,
179 "<?xml version='1.0' encoding='utf-8'?>",
180 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
181 " <Fragment>",
182 " <Property Id='Prop'>",
183 " <![CDATA[1<2]]>",
184 " </Property>",
185 " </Fragment>",
186 "</Wix>");
187
188 var expected = String.Join(Environment.NewLine,
189 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
190 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
191 " <Fragment>",
192 " <Property Id=\"Prop\"><![CDATA[1<2]]></Property>",
193 " </Fragment>",
194 "</Wix>");
195
196 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
197
198 var messaging = new DummyMessaging();
199 var converter = new Wix3Converter(messaging, 2, null, null);
200
201 var errors = converter.ConvertDocument(document);
202
203 var actual = UnformattedDocumentString(document);
204
205 Assert.Equal(expected, actual);
206 Assert.Equal(2, errors);
207 }
208
209 [Fact]
210 public void CanFixCdataWithWhitespace()
211 {
212 var parse = String.Join(Environment.NewLine,
213 "<?xml version='1.0' encoding='utf-8'?>",
214 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
215 " <Fragment>",
216 " <Property Id='Prop'>",
217 " <![CDATA[",
218 " 1<2",
219 " ]]>",
220 " </Property>",
221 " </Fragment>",
222 "</Wix>");
223
224 var expected = String.Join(Environment.NewLine,
225 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
226 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
227 " <Fragment>",
228 " <Property Id=\"Prop\"><![CDATA[1<2]]></Property>",
229 " </Fragment>",
230 "</Wix>");
231
232 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
233
234 var messaging = new DummyMessaging();
235 var converter = new Wix3Converter(messaging, 2, null, null);
236
237 var errors = converter.ConvertDocument(document);
238
239 var actual = UnformattedDocumentString(document);
240
241 Assert.Equal(expected, actual);
242 Assert.Equal(2, errors);
243 }
244
245 [Fact]
246 public void CanConvertMainNamespace()
247 {
248 var parse = String.Join(Environment.NewLine,
249 "<?xml version='1.0' encoding='utf-8'?>",
250 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
251 " <Fragment />",
252 "</Wix>");
253
254 var expected = String.Join(Environment.NewLine,
255 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
256 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
257 " <Fragment />",
258 "</Wix>");
259
260 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
261
262 var messaging = new DummyMessaging();
263 var converter = new Wix3Converter(messaging, 2, null, null);
264
265 var errors = converter.ConvertDocument(document);
266
267 var actual = UnformattedDocumentString(document);
268
269 Assert.Equal(1, errors);
270 //Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace());
271 Assert.Equal(expected, actual);
272 }
273
274 [Fact]
275 public void CanConvertNamedMainNamespace()
276 {
277 var parse = String.Join(Environment.NewLine,
278 "<?xml version='1.0' encoding='utf-8'?>",
279 "<w:Wix xmlns:w='http://schemas.microsoft.com/wix/2006/wi'>",
280 " <w:Fragment />",
281 "</w:Wix>");
282
283 var expected = String.Join(Environment.NewLine,
284 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
285 "<w:Wix xmlns:w=\"http://wixtoolset.org/schemas/v4/wxs\">",
286 " <w:Fragment />",
287 "</w:Wix>");
288
289 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
290
291 var messaging = new DummyMessaging();
292 var converter = new Wix3Converter(messaging, 2, null, null);
293
294 var errors = converter.ConvertDocument(document);
295
296 var actual = UnformattedDocumentString(document);
297
298 Assert.Equal(1, errors);
299 Assert.Equal(expected, actual);
300 Assert.Equal(Wix4Namespace, document.Root.GetNamespaceOfPrefix("w"));
301 }
302
303 [Fact]
304 public void CanConvertNonWixDefaultNamespace()
305 {
306 var parse = String.Join(Environment.NewLine,
307 "<?xml version='1.0' encoding='utf-8'?>",
308 "<w:Wix xmlns:w='http://schemas.microsoft.com/wix/2006/wi' xmlns='http://schemas.microsoft.com/wix/UtilExtension'>",
309 " <w:Fragment>",
310 " <Test />",
311 " </w:Fragment>",
312 "</w:Wix>");
313
314 var expected = String.Join(Environment.NewLine,
315 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
316 "<w:Wix xmlns:w=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
317 " <w:Fragment>",
318 " <Test />",
319 " </w:Fragment>",
320 "</w:Wix>");
321
322 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
323
324 var messaging = new DummyMessaging();
325 var converter = new Wix3Converter(messaging, 2, null, null);
326
327 var errors = converter.ConvertDocument(document);
328
329 var actual = UnformattedDocumentString(document);
330
331 Assert.Equal(expected, actual);
332 Assert.Equal(2, errors);
333 Assert.Equal(Wix4Namespace, document.Root.GetNamespaceOfPrefix("w"));
334 Assert.Equal("http://wixtoolset.org/schemas/v4/wxs/util", document.Root.GetDefaultNamespace());
335 }
336
337 [Fact]
338 public void CanConvertExtensionNamespace()
339 {
340 var parse = String.Join(Environment.NewLine,
341 "<?xml version='1.0' encoding='utf-8'?>",
342 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
343 " <Fragment />",
344 "</Wix>");
345
346 var expected = String.Join(Environment.NewLine,
347 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
348 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
349 " <Fragment />",
350 "</Wix>");
351
352 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
353
354 var messaging = new DummyMessaging();
355 var converter = new Wix3Converter(messaging, 2, null, null);
356
357 var errors = converter.ConvertDocument(document);
358
359 var actual = UnformattedDocumentString(document);
360
361 Assert.Equal(2, errors);
362 Assert.Equal(expected, actual);
363 Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace());
364 }
365
366 [Fact]
367 public void CanConvertMissingNamespace()
368 {
369 var parse = String.Join(Environment.NewLine,
370 "<?xml version='1.0' encoding='utf-8'?>",
371 "<Wix>",
372 " <Fragment />",
373 "</Wix>");
374
375 var expected = String.Join(Environment.NewLine,
376 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
377 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
378 " <Fragment />",
379 "</Wix>");
380
381 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
382
383 var messaging = new DummyMessaging();
384 var converter = new Wix3Converter(messaging, 2, null, null);
385
386 var errors = converter.ConvertDocument(document);
387
388 var actual = UnformattedDocumentString(document);
389
390 Assert.Equal(1, errors);
391 Assert.Equal(expected, actual);
392 Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace());
393 }
394
395 [Fact]
396 public void CanConvertAnonymousFile()
397 {
398 var parse = String.Join(Environment.NewLine,
399 "<?xml version='1.0' encoding='utf-8'?>",
400 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
401 " <File Source='path\\to\\foo.txt' />",
402 "</Wix>");
403
404 var expected = String.Join(Environment.NewLine,
405 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
406 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
407 " <File Id=\"foo.txt\" Source=\"path\\to\\foo.txt\" />",
408 "</Wix>");
409
410 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
411
412 var messaging = new DummyMessaging();
413 var converter = new Wix3Converter(messaging, 2, null, null);
414
415 var errors = converter.ConvertDocument(document);
416
417 var actual = UnformattedDocumentString(document);
418
419 Assert.Equal(1, errors);
420 Assert.Equal(expected, actual);
421 }
422
423 [Fact]
424 public void CanConvertShortNameDirectoryWithoutName()
425 {
426 var parse = String.Join(Environment.NewLine,
427 "<?xml version='1.0' encoding='utf-8'?>",
428 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
429 " <Directory ShortName='iamshort' />",
430 "</Wix>");
431
432 var expected = String.Join(Environment.NewLine,
433 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
434 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
435 " <Directory Name=\"iamshort\" />",
436 "</Wix>");
437
438 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
439
440 var messaging = new DummyMessaging();
441 var converter = new Wix3Converter(messaging, 2, null, null);
442
443 var errors = converter.ConvertDocument(document);
444
445 var actual = UnformattedDocumentString(document);
446
447 Assert.Equal(1, errors);
448 Assert.Equal(expected, actual);
449 }
450
451 [Fact]
452 public void CanConvertSuppressSignatureValidationNo()
453 {
454 var parse = String.Join(Environment.NewLine,
455 "<?xml version='1.0' encoding='utf-8'?>",
456 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
457 " <MsiPackage SuppressSignatureValidation='no' />",
458 "</Wix>");
459
460 var expected = String.Join(Environment.NewLine,
461 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
462 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
463 " <MsiPackage EnableSignatureValidation=\"yes\" />",
464 "</Wix>");
465
466 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
467
468 var messaging = new DummyMessaging();
469 var converter = new Wix3Converter(messaging, 2, null, null);
470
471 var errors = converter.ConvertDocument(document);
472
473 var actual = UnformattedDocumentString(document);
474
475 Assert.Equal(1, errors);
476 Assert.Equal(expected, actual);
477 }
478
479 [Fact]
480 public void CanConvertSuppressSignatureValidationYes()
481 {
482 var parse = String.Join(Environment.NewLine,
483 "<?xml version='1.0' encoding='utf-8'?>",
484 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
485 " <Payload SuppressSignatureValidation='yes' />",
486 "</Wix>");
487
488 var expected = String.Join(Environment.NewLine,
489 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
490 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
491 " <Payload />",
492 "</Wix>");
493
494 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
495
496 var messaging = new DummyMessaging();
497 var converter = new Wix3Converter(messaging, 2, null, null);
498
499 var errors = converter.ConvertDocument(document);
500
501 var actual = UnformattedDocumentString(document);
502
503 Assert.Equal(1, errors);
504 Assert.Equal(expected, actual);
505 }
506
507 private static string UnformattedDocumentString(XDocument document)
508 {
509 var sb = new StringBuilder();
510
511 using (var writer = new StringWriter(sb))
512 {
513 document.Save(writer, SaveOptions.DisableFormatting);
514 }
515
516 return sb.ToString();
517 }
518
519 private class DummyMessaging : IMessaging
520 {
521 public bool EncounteredError { get; set; }
522
523 public int LastErrorNumber { get; set; }
524
525 public bool ShowVerboseMessages { get; set; }
526
527 public bool SuppressAllWarnings { get; set; }
528
529 public bool WarningsAsError { get; set; }
530
531 public void ElevateWarningMessage(int warningNumber)
532 {
533 }
534
535 public string FormatMessage(Message message) => String.Empty;
536
537 public void SetListener(IMessageListener listener)
538 {
539 }
540
541 public void SuppressWarningMessage(int warningNumber)
542 {
543 }
544
545 public void Write(Message message)
546 {
547 }
548
549 public void Write(string message, bool verbose = false)
550 {
551 }
552 }
553 }
554}
diff --git a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs
new file mode 100644
index 00000000..dcd43e35
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs
@@ -0,0 +1,62 @@
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.Converters/TestData/Preprocessor/Preprocessor.wxs b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.wxs
new file mode 100644
index 00000000..2eb908c2
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/Preprocessor.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://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.Converters/TestData/Preprocessor/wixcop.settings.xml b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml
new file mode 100644
index 00000000..9d3ad496
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/wixcop.settings.xml
@@ -0,0 +1,9 @@
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.Converters/TestData/QtExec.bad/v3.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v3.wxs
new file mode 100644
index 00000000..b0630f65
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/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.Converters/TestData/QtExec.bad/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs
new file mode 100644
index 00000000..be487147
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/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.Converters/TestData/QtExec/v3.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec/v3.wxs
new file mode 100644
index 00000000..8d81a758
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/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.Converters/TestData/QtExec/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs
new file mode 100644
index 00000000..22a961b2
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/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.Converters/TestData/SingleFile/ConvertedSingleFile.wxs b/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs
new file mode 100644
index 00000000..aacb68fa
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs
@@ -0,0 +1,60 @@
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.Converters/TestData/SingleFile/SingleFile.wxs b/src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs
new file mode 100644
index 00000000..310ae811
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/TestData/SingleFile/SingleFile.wxs
@@ -0,0 +1,61 @@
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.Converters/WixToolsetTest.Converters.csproj b/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj
new file mode 100644
index 00000000..d16c3d16
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/WixToolsetTest.Converters.csproj
@@ -0,0 +1,39 @@
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>netcoreapp2.1</TargetFramework>
7 <IsPackable>false</IsPackable>
8 </PropertyGroup>
9
10 <ItemGroup>
11 <None Remove="TestData\SingleFile\ConvertedSingleFile.wxs" />
12 <None Remove="TestData\SingleFile\SingleFile.wxs" />
13 </ItemGroup>
14 <ItemGroup>
15 <Content Include="TestData\SingleFile\ConvertedSingleFile.wxs" CopyToOutputDirectory="PreserveNewest" />
16 <Content Include="TestData\SingleFile\SingleFile.wxs" CopyToOutputDirectory="PreserveNewest" />
17 <Content Include="TestData\Preprocessor\ConvertedPreprocessor.wxs" CopyToOutputDirectory="PreserveNewest" />
18 <Content Include="TestData\Preprocessor\Preprocessor.wxs" CopyToOutputDirectory="PreserveNewest" />
19 <Content Include="TestData\Preprocessor\wixcop.settings.xml" CopyToOutputDirectory="PreserveNewest" />
20 <Content Include="TestData\QtExec\v3.wxs" CopyToOutputDirectory="PreserveNewest" />
21 <Content Include="TestData\QtExec\v4_expected.wxs" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="TestData\QtExec.bad\v3.wxs" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="TestData\QtExec.bad\v4_expected.wxs" CopyToOutputDirectory="PreserveNewest" />
24 </ItemGroup>
25
26 <ItemGroup>
27 <ProjectReference Include="..\..\WixToolset.Converters\WixToolset.Converters.csproj" />
28 </ItemGroup>
29
30 <ItemGroup>
31 <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
32 </ItemGroup>
33
34 <ItemGroup>
35 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
36 <PackageReference Include="xunit" Version="2.4.1" />
37 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
38 </ItemGroup>
39</Project>