diff options
3 files changed, 74 insertions, 5 deletions
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 46b79484..89ca94ba 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
@@ -197,7 +197,7 @@ namespace WixToolset.Core | |||
197 | parentName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 197 | parentName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
198 | break; | 198 | break; |
199 | case "ProviderKey": | 199 | case "ProviderKey": |
200 | this.ParseBundleProviderKeyAttribute(sourceLineNumbers, node, attrib); | 200 | // This can't be processed until we create the section. |
201 | break; | 201 | break; |
202 | case "SplashScreenSourceFile": | 202 | case "SplashScreenSourceFile": |
203 | splashScreenSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 203 | splashScreenSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
@@ -261,10 +261,20 @@ namespace WixToolset.Core | |||
261 | this.activeName = String.IsNullOrEmpty(name) ? Common.GenerateGuid() : name; | 261 | this.activeName = String.IsNullOrEmpty(name) ? Common.GenerateGuid() : name; |
262 | this.Core.CreateActiveSection(this.activeName, SectionType.Bundle, 0, this.Context.CompilationId); | 262 | this.Core.CreateActiveSection(this.activeName, SectionType.Bundle, 0, this.Context.CompilationId); |
263 | 263 | ||
264 | // Now that the active section is initialized, process only extension attributes. | 264 | // Now that the active section is initialized, process only extension attributes and the special ProviderKey attribute. |
265 | foreach (var attrib in node.Attributes()) | 265 | foreach (var attrib in node.Attributes()) |
266 | { | 266 | { |
267 | if (!String.IsNullOrEmpty(attrib.Name.NamespaceName) && CompilerCore.WixNamespace != attrib.Name.Namespace) | 267 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) |
268 | { | ||
269 | switch (attrib.Name.LocalName) | ||
270 | { | ||
271 | case "ProviderKey": | ||
272 | this.ParseBundleProviderKeyAttribute(sourceLineNumbers, node, attrib); | ||
273 | break; | ||
274 | // Unknown attributes were reported earlier. | ||
275 | } | ||
276 | } | ||
277 | else | ||
268 | { | 278 | { |
269 | this.Core.ParseExtensionAttribute(node, attrib); | 279 | this.Core.ParseExtensionAttribute(node, attrib); |
270 | } | 280 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs index de038bde..48270ce4 100644 --- a/src/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/DependencyExtensionFixture.cs | |||
@@ -57,12 +57,61 @@ namespace WixToolsetTest.CoreIntegration | |||
57 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); | 57 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); |
58 | extractResult.AssertSuccess(); | 58 | extractResult.AssertSuccess(); |
59 | 59 | ||
60 | var provides = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Chain/burn:MsiPackage/burn:Provides"); | 60 | var provides = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Chain/burn:MsiPackage/burn:Provides") |
61 | .Cast<XmlElement>() | ||
62 | .Select(e => e.GetTestXml()) | ||
63 | .ToArray(); | ||
61 | WixAssert.CompareLineByLine(new string[] | 64 | WixAssert.CompareLineByLine(new string[] |
62 | { | 65 | { |
63 | "<Provides Key='UsingProvides' Imported='yes' />", | 66 | "<Provides Key='UsingProvides' Imported='yes' />", |
64 | "<Provides Key='{A81D50F9-B696-4F3D-ABE0-E64D61590E5F}' Version='1.0.0.0' DisplayName='MsiPackage' />", | 67 | "<Provides Key='{A81D50F9-B696-4F3D-ABE0-E64D61590E5F}' Version='1.0.0.0' DisplayName='MsiPackage' />", |
65 | }, provides.Cast<XmlElement>().Select(e => e.GetTestXml()).ToArray()); | 68 | }, provides); |
69 | } | ||
70 | } | ||
71 | |||
72 | [Fact] | ||
73 | public void CanBuildBundleWithCustomProviderKey() | ||
74 | { | ||
75 | var folder = TestData.Get(@"TestData"); | ||
76 | |||
77 | using (var fs = new DisposableFileSystem()) | ||
78 | { | ||
79 | var baseFolder = fs.GetFolder(); | ||
80 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
81 | var binFolder = Path.Combine(baseFolder, "bin"); | ||
82 | var bundlePath = Path.Combine(binFolder, "test.exe"); | ||
83 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
84 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
85 | |||
86 | var result = WixRunner.Execute(new[] | ||
87 | { | ||
88 | "build", | ||
89 | Path.Combine(folder, "Dependency", "CustomProviderKeyBundle.wxs"), | ||
90 | Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"), | ||
91 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), | ||
92 | "-intermediateFolder", intermediateFolder, | ||
93 | "-o", bundlePath, | ||
94 | }); | ||
95 | |||
96 | result.AssertSuccess(); | ||
97 | |||
98 | Assert.True(File.Exists(bundlePath)); | ||
99 | |||
100 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); | ||
101 | extractResult.AssertSuccess(); | ||
102 | |||
103 | var ignoreAttributesByElementName = new Dictionary<string, List<string>> | ||
104 | { | ||
105 | { "Registration", new List<string> { "Id" } }, | ||
106 | }; | ||
107 | var registration = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Registration") | ||
108 | .Cast<XmlElement>() | ||
109 | .Select(e => e.GetTestXml(ignoreAttributesByElementName)) | ||
110 | .ToArray(); | ||
111 | WixAssert.CompareLineByLine(new string[] | ||
112 | { | ||
113 | "<Registration Id='*' ExecutableName='test.exe' PerMachine='yes' Tag='' Version='1.0.0.0' ProviderKey='MyProviderKey,v1.0'><Arp Register='yes' DisplayName='BurnBundle' DisplayVersion='1.0.0.0' Publisher='Example Corporation' /></Registration>", | ||
114 | }, registration); | ||
66 | } | 115 | } |
67 | } | 116 | } |
68 | 117 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Dependency/CustomProviderKeyBundle.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Dependency/CustomProviderKeyBundle.wxs new file mode 100644 index 00000000..6df8a7c0 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Dependency/CustomProviderKeyBundle.wxs | |||
@@ -0,0 +1,10 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
2 | <Bundle Name="BurnBundle" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="B94478B1-E1F3-4700-9CE8-6AA090854AEC" ProviderKey="MyProviderKey,v1.0"> | ||
3 | <BootstrapperApplication> | ||
4 | <BootstrapperApplicationDll SourceFile="fakeba.dll" /> | ||
5 | </BootstrapperApplication> | ||
6 | <Chain> | ||
7 | <PackageGroupRef Id="MinimalPackageGroup" /> | ||
8 | </Chain> | ||
9 | </Bundle> | ||
10 | </Wix> | ||