diff options
author | Ron Martin <cpuwzd@comcast.net> | 2021-07-02 23:06:44 -0400 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2021-07-05 18:57:47 -0400 |
commit | 0c0bb770717785e0a144272cbd9fe6390452fb64 (patch) | |
tree | 49ff80ef1e9ffc6b253c68eb86dc78214c25cada | |
parent | 32b262ea3111e051802475b935290f643e14f730 (diff) | |
download | wix-0c0bb770717785e0a144272cbd9fe6390452fb64.tar.gz wix-0c0bb770717785e0a144272cbd9fe6390452fb64.tar.bz2 wix-0c0bb770717785e0a144272cbd9fe6390452fb64.zip |
See wixtoolset/Issues/4726.
Implements actually failing and potentially failing tests for the proper enforcement of proper field widths for major an minor version numbers for advertised and unadvertised type ibraries.
Implements the enforcement of proper field widths for major an minor version numbers for advertised and unadvertised type libraries. See wixtoolset/Issues/4726.
11 files changed, 338 insertions, 15 deletions
diff --git a/src/wix/WixToolset.Core/Compiler_Package.cs b/src/wix/WixToolset.Core/Compiler_Package.cs index 87ccceb7..d3db2e80 100644 --- a/src/wix/WixToolset.Core/Compiler_Package.cs +++ b/src/wix/WixToolset.Core/Compiler_Package.cs | |||
@@ -4362,8 +4362,8 @@ namespace WixToolset.Core | |||
4362 | string helpDirectoryId = null; | 4362 | string helpDirectoryId = null; |
4363 | string helpSubdirectory = null; | 4363 | string helpSubdirectory = null; |
4364 | var language = CompilerConstants.IntegerNotSet; | 4364 | var language = CompilerConstants.IntegerNotSet; |
4365 | var majorVersion = CompilerConstants.IntegerNotSet; | 4365 | XAttribute majorVersionAttrib = null; |
4366 | var minorVersion = CompilerConstants.IntegerNotSet; | 4366 | XAttribute minorVersionAttrib = null; |
4367 | var resourceId = CompilerConstants.LongNotSet; | 4367 | var resourceId = CompilerConstants.LongNotSet; |
4368 | 4368 | ||
4369 | foreach (var attrib in node.Attributes()) | 4369 | foreach (var attrib in node.Attributes()) |
@@ -4413,10 +4413,10 @@ namespace WixToolset.Core | |||
4413 | language = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); | 4413 | language = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); |
4414 | break; | 4414 | break; |
4415 | case "MajorVersion": | 4415 | case "MajorVersion": |
4416 | majorVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, UInt16.MaxValue); | 4416 | majorVersionAttrib = attrib; |
4417 | break; | 4417 | break; |
4418 | case "MinorVersion": | 4418 | case "MinorVersion": |
4419 | minorVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Byte.MaxValue); | 4419 | minorVersionAttrib = attrib; |
4420 | break; | 4420 | break; |
4421 | case "ResourceId": | 4421 | case "ResourceId": |
4422 | resourceId = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, Int32.MinValue, Int32.MaxValue); | 4422 | resourceId = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, Int32.MinValue, Int32.MaxValue); |
@@ -4451,11 +4451,20 @@ namespace WixToolset.Core | |||
4451 | 4451 | ||
4452 | helpDirectoryId = this.HandleSubdirectory(sourceLineNumbers, node, helpDirectoryId, helpSubdirectory, "HelpDirectory", "HelpSubdirectory"); | 4452 | helpDirectoryId = this.HandleSubdirectory(sourceLineNumbers, node, helpDirectoryId, helpSubdirectory, "HelpDirectory", "HelpSubdirectory"); |
4453 | 4453 | ||
4454 | // if the advertise state has not been set, default to non-advertised | ||
4455 | if (YesNoType.NotSet == advertise) | ||
4456 | { | ||
4457 | advertise = YesNoType.No; | ||
4458 | } | ||
4459 | |||
4460 | var majorVersion = (null == majorVersionAttrib) ? CompilerConstants.IntegerNotSet : this.Core.GetAttributeIntegerValue(sourceLineNumbers, majorVersionAttrib, 0, UInt16.MaxValue); | ||
4461 | var minorVersion = (null == minorVersionAttrib) ? CompilerConstants.IntegerNotSet : this.Core.GetAttributeIntegerValue(sourceLineNumbers, minorVersionAttrib, 0, (YesNoType.Yes == advertise) ? Byte.MaxValue : UInt16.MaxValue); | ||
4462 | |||
4454 | // build up the typelib version string for the registry if the major or minor version was specified | 4463 | // build up the typelib version string for the registry if the major or minor version was specified |
4455 | string registryVersion = null; | 4464 | string registryVersion = null; |
4456 | if (CompilerConstants.IntegerNotSet != majorVersion || CompilerConstants.IntegerNotSet != minorVersion) | 4465 | if (null != majorVersionAttrib || null != minorVersionAttrib) |
4457 | { | 4466 | { |
4458 | if (CompilerConstants.IntegerNotSet != majorVersion) | 4467 | if (null != majorVersionAttrib) |
4459 | { | 4468 | { |
4460 | registryVersion = majorVersion.ToString("x", CultureInfo.InvariantCulture.NumberFormat); | 4469 | registryVersion = majorVersion.ToString("x", CultureInfo.InvariantCulture.NumberFormat); |
4461 | } | 4470 | } |
@@ -4464,7 +4473,7 @@ namespace WixToolset.Core | |||
4464 | registryVersion = "0"; | 4473 | registryVersion = "0"; |
4465 | } | 4474 | } |
4466 | 4475 | ||
4467 | if (CompilerConstants.IntegerNotSet != minorVersion) | 4476 | if (null != minorVersionAttrib) |
4468 | { | 4477 | { |
4469 | registryVersion = String.Concat(registryVersion, ".", minorVersion.ToString("x", CultureInfo.InvariantCulture.NumberFormat)); | 4478 | registryVersion = String.Concat(registryVersion, ".", minorVersion.ToString("x", CultureInfo.InvariantCulture.NumberFormat)); |
4470 | } | 4479 | } |
@@ -4474,12 +4483,6 @@ namespace WixToolset.Core | |||
4474 | } | 4483 | } |
4475 | } | 4484 | } |
4476 | 4485 | ||
4477 | // if the advertise state has not been set, default to non-advertised | ||
4478 | if (YesNoType.NotSet == advertise) | ||
4479 | { | ||
4480 | advertise = YesNoType.No; | ||
4481 | } | ||
4482 | |||
4483 | foreach (var child in node.Elements()) | 4486 | foreach (var child in node.Elements()) |
4484 | { | 4487 | { |
4485 | if (CompilerCore.WixNamespace == child.Name.Namespace) | 4488 | if (CompilerCore.WixNamespace == child.Name.Namespace) |
@@ -4549,9 +4552,9 @@ namespace WixToolset.Core | |||
4549 | FeatureRef = Guid.Empty.ToString("B") | 4552 | FeatureRef = Guid.Empty.ToString("B") |
4550 | }); | 4553 | }); |
4551 | 4554 | ||
4552 | if (CompilerConstants.IntegerNotSet != majorVersion || CompilerConstants.IntegerNotSet != minorVersion) | 4555 | if (null != majorVersionAttrib || null != minorVersionAttrib) |
4553 | { | 4556 | { |
4554 | symbol.Version = (CompilerConstants.IntegerNotSet != majorVersion ? majorVersion * 256 : 0) + (CompilerConstants.IntegerNotSet != minorVersion ? minorVersion : 0); | 4557 | symbol.Version = (null != majorVersionAttrib ? majorVersion * 256 : 0) + (null != minorVersionAttrib ? minorVersion : 0); |
4555 | } | 4558 | } |
4556 | 4559 | ||
4557 | if (CompilerConstants.IntegerNotSet != cost) | 4560 | if (CompilerConstants.IntegerNotSet != cost) |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/AdvertisedTypeLibVersionFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/AdvertisedTypeLibVersionFixture.cs new file mode 100644 index 00000000..106e2483 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/AdvertisedTypeLibVersionFixture.cs | |||
@@ -0,0 +1,111 @@ | |||
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 | |||
3 | namespace WixToolsetTest.CoreIntegration | ||
4 | { | ||
5 | using System.IO; | ||
6 | using WixBuildTools.TestSupport; | ||
7 | using WixToolset.Core.TestPackage; | ||
8 | using WixToolset.Data; | ||
9 | using Xunit; | ||
10 | |||
11 | public class AdvertisedTypeLibVersionFixture | ||
12 | { | ||
13 | [Fact] | ||
14 | public void Allows16BitTypeLibMajorVersion() | ||
15 | { | ||
16 | var folder = TestData.Get(@"TestData"); | ||
17 | |||
18 | using (var fs = new DisposableFileSystem()) | ||
19 | { | ||
20 | var baseFolder = fs.GetFolder(); | ||
21 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
22 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
23 | |||
24 | var result = WixRunner.Execute(new[] | ||
25 | { | ||
26 | "build", | ||
27 | Path.Combine(folder, "AdvertisedTypeLib", "MajorVersion16Bit.wxs"), | ||
28 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
29 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
30 | "-intermediateFolder", intermediateFolder, | ||
31 | "-o", msiPath | ||
32 | }); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | [Fact] | ||
37 | public void DoesNotAllow17BitTypeLibMajorVersion() | ||
38 | { | ||
39 | var folder = TestData.Get(@"TestData"); | ||
40 | |||
41 | using (var fs = new DisposableFileSystem()) | ||
42 | { | ||
43 | var baseFolder = fs.GetFolder(); | ||
44 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
45 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
46 | |||
47 | var result = WixRunner.Execute(new[] | ||
48 | { | ||
49 | "build", | ||
50 | Path.Combine(folder, "AdvertisedTypeLib", "MajorVersion17Bit.wxs"), | ||
51 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
52 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
53 | "-intermediateFolder", intermediateFolder, | ||
54 | "-o", msiPath | ||
55 | }); | ||
56 | |||
57 | Assert.True(result.ExitCode == (int)ErrorMessages.Ids.IntegralValueOutOfRange); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | [Fact] | ||
62 | public void Allows8BitTypeLibMinorVersion() | ||
63 | { | ||
64 | var folder = TestData.Get(@"TestData"); | ||
65 | |||
66 | using (var fs = new DisposableFileSystem()) | ||
67 | { | ||
68 | var baseFolder = fs.GetFolder(); | ||
69 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
70 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
71 | |||
72 | var result = WixRunner.Execute(new[] | ||
73 | { | ||
74 | "build", | ||
75 | Path.Combine(folder, "AdvertisedTypeLib", "MinorVersion8Bit.wxs"), | ||
76 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
77 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
78 | "-intermediateFolder", intermediateFolder, | ||
79 | "-o", msiPath | ||
80 | }); | ||
81 | |||
82 | result.AssertSuccess(); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | [Fact] | ||
87 | public void DoesNotAllow9BitTypeLibMinorVersion() | ||
88 | { | ||
89 | var folder = TestData.Get(@"TestData"); | ||
90 | |||
91 | using (var fs = new DisposableFileSystem()) | ||
92 | { | ||
93 | var baseFolder = fs.GetFolder(); | ||
94 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
95 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
96 | |||
97 | var result = WixRunner.Execute(new[] | ||
98 | { | ||
99 | "build", | ||
100 | Path.Combine(folder, "AdvertisedTypeLib", "MinorVersion9Bit.wxs"), | ||
101 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
102 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
103 | "-intermediateFolder", intermediateFolder, | ||
104 | "-o", msiPath | ||
105 | }); | ||
106 | |||
107 | Assert.True(result.ExitCode == (int)ErrorMessages.Ids.IntegralValueOutOfRange); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | } | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MajorVersion16Bit.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MajorVersion16Bit.wxs new file mode 100644 index 00000000..72ef1b79 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MajorVersion16Bit.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="TypeLibComp" Directory="INSTALLFOLDER" Guid="8E262DD2-04FE-4213-92D9-CFA0D392DC46"> | ||
6 | <File Source="test.txt" Name="TypeLibComp.txt"> | ||
7 | <TypeLib Id="FF19093C-EA7A-4C41-9C1B-D706ECD9009F" Advertise="yes" Language="1033" MajorVersion="65535" MinorVersion="0" /> | ||
8 | </File> | ||
9 | </Component> | ||
10 | </ComponentGroup> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MajorVersion17Bit.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MajorVersion17Bit.wxs new file mode 100644 index 00000000..f52de276 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MajorVersion17Bit.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="TypeLibComp" Directory="INSTALLFOLDER" Guid="8E262DD2-04FE-4213-92D9-CFA0D392DC46"> | ||
6 | <File Source="test.txt" Name="TypeLibComp.txt"> | ||
7 | <TypeLib Id="FF19093C-EA7A-4C41-9C1B-D706ECD9009F" Advertise="yes" Language="1033" MajorVersion="65536" MinorVersion="0" /> | ||
8 | </File> | ||
9 | </Component> | ||
10 | </ComponentGroup> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MinorVersion8Bit.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MinorVersion8Bit.wxs new file mode 100644 index 00000000..5e59c307 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MinorVersion8Bit.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="TypeLibComp" Directory="INSTALLFOLDER" Guid="8E262DD2-04FE-4213-92D9-CFA0D392DC46"> | ||
6 | <File Source="test.txt" Name="TypeLibComp.txt"> | ||
7 | <TypeLib Id="FF19093C-EA7A-4C41-9C1B-D706ECD9009F" Advertise="yes" Language="1033" MajorVersion="1" MinorVersion="255" /> | ||
8 | </File> | ||
9 | </Component> | ||
10 | </ComponentGroup> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MinorVersion9Bit.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MinorVersion9Bit.wxs new file mode 100644 index 00000000..20185a42 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AdvertisedTypeLib/MinorVersion9Bit.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="TypeLibComp" Directory="INSTALLFOLDER" Guid="8E262DD2-04FE-4213-92D9-CFA0D392DC46"> | ||
6 | <File Source="test.txt" Name="TypeLibComp.txt"> | ||
7 | <TypeLib Id="FF19093C-EA7A-4C41-9C1B-D706ECD9009F" Advertise="yes" Language="1033" MajorVersion="1" MinorVersion="256" /> | ||
8 | </File> | ||
9 | </Component> | ||
10 | </ComponentGroup> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MajorVersion16Bit.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MajorVersion16Bit.wxs new file mode 100644 index 00000000..e56356c0 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MajorVersion16Bit.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="TypeLibComp" Directory="INSTALLFOLDER" Guid="8E262DD2-04FE-4213-92D9-CFA0D392DC46"> | ||
6 | <File Source="test.txt" Name="TypeLibComp.txt"> | ||
7 | <TypeLib Id="FF19093C-EA7A-4C41-9C1B-D706ECD9009F" Advertise="no" Language="1033" MajorVersion="65535" MinorVersion="0" /> | ||
8 | </File> | ||
9 | </Component> | ||
10 | </ComponentGroup> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MajorVersion17Bit.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MajorVersion17Bit.wxs new file mode 100644 index 00000000..4a92da46 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MajorVersion17Bit.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="TypeLibComp" Directory="INSTALLFOLDER" Guid="8E262DD2-04FE-4213-92D9-CFA0D392DC46"> | ||
6 | <File Source="test.txt" Name="TypeLibComp.txt"> | ||
7 | <TypeLib Id="FF19093C-EA7A-4C41-9C1B-D706ECD9009F" Advertise="no" Language="1033" MajorVersion="65536" MinorVersion="0" /> | ||
8 | </File> | ||
9 | </Component> | ||
10 | </ComponentGroup> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MinorVersion16Bit.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MinorVersion16Bit.wxs new file mode 100644 index 00000000..cd7383cd --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MinorVersion16Bit.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="TypeLibComp" Directory="INSTALLFOLDER" Guid="8E262DD2-04FE-4213-92D9-CFA0D392DC46"> | ||
6 | <File Source="test.txt" Name="TypeLibComp.txt"> | ||
7 | <TypeLib Id="FF19093C-EA7A-4C41-9C1B-D706ECD9009F" Advertise="no" Language="1033" MajorVersion="1" MinorVersion="65535" /> | ||
8 | </File> | ||
9 | </Component> | ||
10 | </ComponentGroup> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MinorVersion17Bit.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MinorVersion17Bit.wxs new file mode 100644 index 00000000..801f0a2d --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/UnadvertisedTypeLib/MinorVersion17Bit.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents"> | ||
5 | <Component Id="TypeLibComp" Directory="INSTALLFOLDER" Guid="8E262DD2-04FE-4213-92D9-CFA0D392DC46"> | ||
6 | <File Source="test.txt" Name="TypeLibComp.txt"> | ||
7 | <TypeLib Id="FF19093C-EA7A-4C41-9C1B-D706ECD9009F" Advertise="no" Language="1033" MajorVersion="1" MinorVersion="65536" /> | ||
8 | </File> | ||
9 | </Component> | ||
10 | </ComponentGroup> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/UnadvertisedTypeLibVersionFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/UnadvertisedTypeLibVersionFixture.cs new file mode 100644 index 00000000..247902c1 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/UnadvertisedTypeLibVersionFixture.cs | |||
@@ -0,0 +1,113 @@ | |||
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 | |||
3 | namespace WixToolsetTest.CoreIntegration | ||
4 | { | ||
5 | using System.IO; | ||
6 | using WixBuildTools.TestSupport; | ||
7 | using WixToolset.Core.TestPackage; | ||
8 | using WixToolset.Data; | ||
9 | using Xunit; | ||
10 | |||
11 | public class UnadvertisedTypeLibVersionFixture | ||
12 | { | ||
13 | [Fact] | ||
14 | public void Allows16BitTypeLibMajorVersion() | ||
15 | { | ||
16 | var folder = TestData.Get(@"TestData"); | ||
17 | |||
18 | using (var fs = new DisposableFileSystem()) | ||
19 | { | ||
20 | var baseFolder = fs.GetFolder(); | ||
21 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
22 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
23 | |||
24 | var result = WixRunner.Execute(new[] | ||
25 | { | ||
26 | "build", | ||
27 | Path.Combine(folder, "UnadvertisedTypeLib", "MajorVersion16Bit.wxs"), | ||
28 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
29 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
30 | "-intermediateFolder", intermediateFolder, | ||
31 | "-o", msiPath | ||
32 | }); | ||
33 | |||
34 | result.AssertSuccess(); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | [Fact] | ||
39 | public void DoesNotAllow17BitTypeLibMajorVersion() | ||
40 | { | ||
41 | var folder = TestData.Get(@"TestData"); | ||
42 | |||
43 | using (var fs = new DisposableFileSystem()) | ||
44 | { | ||
45 | var baseFolder = fs.GetFolder(); | ||
46 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
47 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
48 | |||
49 | var result = WixRunner.Execute(new[] | ||
50 | { | ||
51 | "build", | ||
52 | Path.Combine(folder, "UnadvertisedTypeLib", "MajorVersion17Bit.wxs"), | ||
53 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
54 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
55 | "-intermediateFolder", intermediateFolder, | ||
56 | "-o", msiPath | ||
57 | }); | ||
58 | |||
59 | Assert.True(result.ExitCode == (int)ErrorMessages.Ids.IntegralValueOutOfRange); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | [Fact] | ||
64 | public void Allows16BitTypeLibMinorVersion() | ||
65 | { | ||
66 | var folder = TestData.Get(@"TestData"); | ||
67 | |||
68 | using (var fs = new DisposableFileSystem()) | ||
69 | { | ||
70 | var baseFolder = fs.GetFolder(); | ||
71 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
72 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
73 | |||
74 | var result = WixRunner.Execute(new[] | ||
75 | { | ||
76 | "build", | ||
77 | Path.Combine(folder, "UnadvertisedTypeLib", "MinorVersion16Bit.wxs"), | ||
78 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
79 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
80 | "-intermediateFolder", intermediateFolder, | ||
81 | "-o", msiPath | ||
82 | }); | ||
83 | |||
84 | result.AssertSuccess(); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | [Fact] | ||
89 | public void DoesNotAllow17BitTypeLibMinorVersion() | ||
90 | { | ||
91 | var folder = TestData.Get(@"TestData"); | ||
92 | |||
93 | using (var fs = new DisposableFileSystem()) | ||
94 | { | ||
95 | var baseFolder = fs.GetFolder(); | ||
96 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
97 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
98 | |||
99 | var result = WixRunner.Execute(new[] | ||
100 | { | ||
101 | "build", | ||
102 | Path.Combine(folder, "UnadvertisedTypeLib", "MinorVersion17Bit.wxs"), | ||
103 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
104 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
105 | "-intermediateFolder", intermediateFolder, | ||
106 | "-o", msiPath | ||
107 | }); | ||
108 | |||
109 | Assert.True(result.ExitCode == (int)ErrorMessages.Ids.IntegralValueOutOfRange); | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | } | ||