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

Signed bootsrapper exe with custom BA does not start embedded MSI #1685

Open
vincentramp opened this issue Dec 5, 2024 · 3 comments
Open

Comments

@vincentramp
Copy link

vincentramp commented Dec 5, 2024

Hi,

Using WixSharp, we created an MSI package, which we embedded in a bootstrapper exe, together with a few internet assemblies, using CustomBA. (Using WIX4.0.3)
Using this bootstrapper exe, installation works fine!

However, if we sign the bootstrapper exe, the bootstrapper will start correctly, but the MSI will not start. The only way to start the MSI, is to make sure the MSI is copied to the same directory as the bootstrapper exe. This step is not needed if we did not sign the bootstrapper exe.

The exception we get in the install log is the following:

[17D8:2B9C][2024-12-05T10:21:48]i000: Setting local source for ApplicationMsi to 'C:\Users\{USERNAME}\Desktop\Company.Application.Setup.exe' (WixBundleOriginalSource)
[17D8:2B9C][2024-12-05T10:21:48]i000: Retry to resolve source for ApplicationMsi
[17D8:2B9C][2024-12-05T10:21:48]i000: Setting local source for WixAttachedContainer to 'C:\Users\{USERNAME}\Desktop\Company.Application.Setup.exe' (WixBundleOriginalSource)
[17D8:2B9C][2024-12-05T10:21:48]i000: Retry to resolve source for WixAttachedContainer
[17D8:2B9C][2024-12-05T10:21:48]e054: Failed to resolve source for payload: (null), package: (null), container: WixAttachedContainer, error: 0x80070002.
[17D8:2B9C][2024-12-05T10:21:48]e000: Error 0x80070002: Failed to resolve source, payload: (null), package: (null), container: WixAttachedContainer
[17D8:2B9C][2024-12-05T10:21:48]e000: Error 0x80070002: Failed to acquire container: WixAttachedContainer
[17D8:2B9C][2024-12-05T10:21:48]e311: Failed to acquire container: WixAttachedContainer to working path: C:\Users\{USERNAME}\AppData\Local\Temp\{DC62151C-CFFC-4775-AEE8-F5C95DDC52F0}\62D5F9619FE3304A266350300506BFEE096FF8B92590F919F24B63AB647C1C274B2D630B2CC26BA3D150FC16A21DB2E5A86A00A0F8F7AC34A145D616BD2094CE, error: 0x80070002.
[17D8:2B9C][2024-12-05T10:21:48]e000: Error 0x80070002: Failed to acquire container: WixAttachedContainer to working path: C:\Users\{USERNAME}\AppData\Local\Temp\{DC62151C-CFFC-4775-AEE8-F5C95DDC52F0}\62D5F9619FE3304A266350300506BFEE096FF8B92590F919F24B63AB647C1C274B2D630B2CC26BA3D150FC16A21DB2E5A86A00A0F8F7AC34A145D616BD2094CE
[17D8:2B9C][2024-12-05T10:21:48]e000: Error 0x80070002: Failed to extract container for payload: ApplicationMsi
[17D8:2B9C][2024-12-05T10:21:48]e000: Error 0x80070002: Failed to acquire payload: ApplicationMsi
[17D8:2B9C][2024-12-05T10:21:48]e313: Failed to acquire payload: ApplicationMsi to working path: C:\Users\{USERNAME}\AppData\Local\Temp\{DC62151C-CFFC-4775-AEE8-F5C95DDC52F0}\ApplicationMsi, error: 0x80070002.
[17D8:2B9C][2024-12-05T10:21:48]e000: Error 0x80070002: Failed to acquire payload: ApplicationMsi to working path: C:\Users\{USERNAME}\AppData\Local\Temp\{DC62151C-CFFC-4775-AEE8-F5C95DDC52F0}\ApplicationMsi
[17D8:2B9C][2024-12-05T10:21:48]e000: Error 0x80070002: Failed cache action: cache package
[17D8:1CE4][2024-12-05T10:21:48]e000: Error 0x80070002: Failed while caching, aborting execution.
[2210:235C][2024-12-05T10:21:48]i351: Removing cached package: ApplicationMsi, from path: C:\ProgramData\Package Cache\{6FE30B47-2577-43AD-9095-1861CA25989D}v1.0.0\

What am I missing in this process?

@Torchok19081986
Copy link

Hallo, i had currently same issue. I solved it in way, that described in https://wixtoolset.org/docs/tools/signing/ Link. Only one diffrence : your CustomBA is silent, i done it for my CustomBA as normal Burn Installer, not silent. Try it, if it solved your issues.
Best regards, Torchok.

@se
Copy link

se commented Feb 9, 2025

Thank you @Torchok19081986. This is the only way...

Hallo, i had currently same issue. I solved it in way, that described in https://wixtoolset.org/docs/tools/signing/ Link. Only one diffrence : your CustomBA is silent, i done it for my CustomBA as normal Burn Installer, not silent. Try it, if it solved your issues. Best regards, Torchok.

@oleg-shilo
Copy link
Owner

oleg-shilo commented Feb 13, 2025

You can use:

var bundle_exe = bundle.Build("my_setup.exe");
Tasks.DigitalySignBootstrapperEngine(bundle_exe, ....)

It does exactly whet https://wixtoolset.org/docs/tools/signing/ Link demonstrates.

Though the implementation is extremely simple so so you can have your custom version of DigitalySignBootstrapperEngine if you need:

static public int DigitalySignBootstrapperEngine(string bootstrapperFileToSign, string pfxFile, string timeURL, string password,
string optionalArguments = null, string wellKnownLocations = null, StoreType certificateStore = StoreType.file, SignOutputLevel outputLevel = SignOutputLevel.Verbose, HashAlgorithmType hashAlgorithm = HashAlgorithmType.sha1)
{
string enginePath = IO.Path.GetTempFileName();
try
{
// First detach the engine from the bundle
Compiler.Run(WixTools.wix, "burn detach \"{0}\" -engine \"{1}\"".FormatWith(bootstrapperFileToSign, enginePath));
if (!IO.File.Exists(enginePath))
throw new Exception($"The supposedly detached engine file appears to be missing. Expected location: '{enginePath}'");
// Then sign the detached engine
int retval = DigitalySign(enginePath, pfxFile, timeURL, password, optionalArguments, wellKnownLocations, certificateStore, outputLevel, hashAlgorithm);
if (retval != 0)
return retval;
// Finally reattach the signed engine to the bundle
Compiler.Run(WixTools.wix, "burn reattach \"{0}\" -engine \"{1}\" -o \"{0}\"".FormatWith(bootstrapperFileToSign, enginePath));
return 0;
}
finally
{
IO.File.Delete(enginePath);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants