Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ExePayloadRef for PrimaryPayloadId and SecondaryPayloadId #532

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
namespace WixToolsetTest.BootstrapperApplications
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using WixToolset.BootstrapperApplications;
using WixInternal.Core.TestPackage;
using WixInternal.TestSupport;
using Xunit;
Expand Down Expand Up @@ -51,6 +50,47 @@ public void CanBuildUsingDisplayInternalUICondition()
}
}

[Fact]
public void CanBuildUsingBootstrapperApplicationId()
{
using (var fs = new DisposableFileSystem())
{
var baseFolder = fs.GetFolder();
var bundleFile = Path.Combine(baseFolder, "bin", "test.exe");
var bundleSourceFolder = TestData.Get("TestData", "WixStdBa");
var intermediateFolder = Path.Combine(baseFolder, "obj");
var baFolderPath = Path.Combine(baseFolder, "ba");
var extractFolderPath = Path.Combine(baseFolder, "extract");

var compileResult = WixRunner.Execute(new[]
{
"build",
Path.Combine(bundleSourceFolder, "BootstrapperApplicationId.wxs"),
"-ext", TestData.Get(@"WixToolset.BootstrapperApplications.wixext.dll"),
"-intermediateFolder", intermediateFolder,
"-bindpath", Path.Combine(bundleSourceFolder, "data"),
"-o", bundleFile,
});
compileResult.AssertSuccess();

Assert.True(File.Exists(bundleFile));

var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath);
extractResult.AssertSuccess();

var ignoreAttributesByElementName = new Dictionary<string, List<string>>
{
{ "Payload", new List<string> { "SourcePath" } },
};

var wixStdBaPayloadInfo = extractResult.GetManifestTestXmlLines("/burn:BurnManifest/burn:UX/burn:Payload[@FilePath='wixstdba.exe']", ignoreAttributesByElementName);
WixAssert.CompareLineByLine(new string[]
{
$@"<Payload Id='WixStandardBootstrapperApplication_X86' FilePath='wixstdba.exe' SourcePath='*' />"
}, wixStdBaPayloadInfo);
}
}

[Fact]
public void CanBuildUsingOverridable()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2">
<BootstrapperApplication Id="Custom">
<bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" />
</BootstrapperApplication>
<Chain>
<MsiPackage SourceFile="test.msi" />
</Chain>
</Bundle>
</Wix>
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ public void Execute()
// write the UX element
writer.WriteStartElement("UX");

writer.WriteAttributeString("PrimaryPayloadId", this.PrimaryBundleApplicationSymbol.Id.Id);
writer.WriteAttributeString("PrimaryPayloadId", this.PrimaryBundleApplicationSymbol.ExePayloadRef);

if (!String.IsNullOrEmpty(this.SecondaryBundleApplicationSymbol?.Id.Id))
if (!String.IsNullOrEmpty(this.SecondaryBundleApplicationSymbol?.ExePayloadRef))
{
writer.WriteAttributeString("SecondaryPayloadId", this.SecondaryBundleApplicationSymbol.Id.Id);
writer.WriteAttributeString("SecondaryPayloadId", this.SecondaryBundleApplicationSymbol.ExePayloadRef);
}

// write the UX allPayloads...
Expand Down
Loading