@joebigelow / wix-1 / commits / d1dbe29f

Add failing test to demonstrate ProgId bug.

When a parent ProgId has Advertise="yes" and a child ProgId omits Advertise, the compiler assumes it's a non-advertised ProgId. It should be advertised instead.

Bob Arnson committed Apr 2, 2019 at 19:23 UTC d1dbe29f3856d012acf5f96e8e66c43b74ab490d
6 files changed +92
src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
+39
@@ -539,6 +539,45 @@ namespace WixToolsetTest.CoreIntegration
539 }
540 }
541
542 + [Fact]
543 + public void CanBuildVersionIndependentProgId()
544 + {
545 + var folder = TestData.Get(@"TestData\ProgId");
546 +
547 + using (var fs = new DisposableFileSystem())
548 + {
549 + var baseFolder = fs.GetFolder();
550 + var intermediateFolder = Path.Combine(baseFolder, "obj");
551 +
552 + var result = WixRunner.Execute(new[]
553 + {
554 + "build",
555 + Path.Combine(folder, "Package.wxs"),
556 + Path.Combine(folder, "PackageComponents.wxs"),
557 + "-loc", Path.Combine(folder, "Package.en-us.wxl"),
558 + "-bindpath", Path.Combine(folder, "data"),
559 + "-intermediateFolder", intermediateFolder,
560 + "-o", Path.Combine(baseFolder, @"bin\test.msi")
561 + });
562 +
563 + result.AssertSuccess();
564 +
565 + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi")));
566 + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
567 + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\MsiPackage\Foo.exe")));
568 +
569 + var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
570 + var section = intermediate.Sections.Single();
571 +
572 + var progids = section.Tuples.OfType<ProgIdTuple>().OrderBy(tuple => tuple.ProgId).ToList();
573 + Assert.Equal(2, progids.Count);
574 + Assert.Equal("Foo.File.hol", progids[0].ProgId);
575 + Assert.Equal("Foo.File.hol.15", progids[0].ProgId_Parent);
576 + Assert.Equal("Foo.File.hol.15", progids[1].ProgId);
577 + Assert.Null(progids[1].ProgId_Parent);
578 + }
579 + }
580 +
581 [Fact(Skip = "Not implemented yet.")]
582 public void CanBuildInstanceTransform()
583 {
src/test/WixToolsetTest.CoreIntegration/TestData/ProgId/Package.en-us.wxl new
+11
@@ -0,0 +1,11 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +
3 +<!--
4 +This file contains the declaration of all the localizable strings.
5 +-->
6 +<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7 +
8 + <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9 + <String Id="FeatureTitle">MsiPackage</String>
10 +
11 +</WixLocalization>
src/test/WixToolsetTest.CoreIntegration/TestData/ProgId/Package.wxs new
+21
@@ -0,0 +1,21 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Product Id="*" Name="ProgId" Codepage="1252" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 + <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5 +
6 + <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
7 + <MediaTemplate />
8 +
9 + <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
10 + <ComponentGroupRef Id="ProductComponents" />
11 + </Feature>
12 + </Product>
13 +
14 + <Fragment>
15 + <Directory Id="TARGETDIR" Name="SourceDir">
16 + <Directory Id="ProgramFilesFolder">
17 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
18 + </Directory>
19 + </Directory>
20 + </Fragment>
21 +</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/ProgId/PackageComponents.wxs new
+16
@@ -0,0 +1,16 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Fragment>
4 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 + <Component>
6 + <File Name="Foo.exe" Source="test.txt" />
7 + <ProgId Id="Foo.File.hol.15" Advertise="yes" Description="Foo Holiday File">
8 + <ProgId Id="Foo.File.hol" />
9 + <Extension Id="hol">
10 + <Verb Id="Open" Argument="/hol &quot;%1&quot;" Sequence="1" />
11 + </Extension>
12 + </ProgId>
13 + </Component>
14 + </ComponentGroup>
15 + </Fragment>
16 +</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/ProgId/data/test.txt new
+1
@@ -0,0 +1 @@
1 +This is test.txt.
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+4
@@ -85,6 +85,10 @@
85 <Content Include="TestData\Wixipl\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
86 <Content Include="TestData\Wixipl\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
87 <Content Include="TestData\Wixipl\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
88 + <Content Include="TestData\ProgId\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
89 + <Content Include="TestData\ProgId\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
90 + <Content Include="TestData\ProgId\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
91 + <Content Include="TestData\ProgId\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
92 </ItemGroup>
93
94 <ItemGroup>