If WixVariables WixMbaPrereqPackageId
and WixMbaPrereqLicenseUrl
are not added, it fails to compile.
The Windows Installer XML variable
!(wix.WixMbaPrereqPackageId)
is unknown.
The Windows Installer XML variable!(wix.WixMbaPrereqLicenseUrl)
is unknown.
If the two variables are added, even though my test computer has .NET Framework 4.0 installed, the bootstrapper installs .NET Framework 4.0 every time.
How to avoid installing .NET Framework when the target computer already has the .NET framework?
Below is my sample code.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="TestBootstrapper" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="e8c02687-b5fe-4842-bcc4-286c2800b556">
<BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
<Payload SourceFile='MyBA.dll' />
</BootstrapperApplicationRef>
<!--<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />-->
<Chain>
<PackageGroupRef
Id="Netfx4Full"/>
<MsiPackage Name="SetupProject1.msi" SourceFile="data\SetupProject1.msi" DownloadUrl="http://myserver/SetupProject1.msi" Compressed="no">
</MsiPackage>
<MsiPackage Name="SetupProject2.msi" SourceFile="data\SetupProject2.msi" DownloadUrl="http://myserver/SetupProject2.msi" Compressed="no">
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<WixVariable
Id="WixMbaPrereqPackageId"
Value="Netfx4Full" />
<WixVariable
Id="WixMbaPrereqLicenseUrl"
Value="NetfxLicense.rtf" />
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<PackageGroup Id="Netfx4Full">
<ExePackage
Id="Netfx4Full"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="dotNetFx40_Full_x86_x64.exe"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" />
</PackageGroup>
</Fragment>
</Wix>
WIX Bootstrapper is started the Framework installation by default, when it is unable to load the MBA. Check with simple message box that your MBA is loaded or not.
You can use the below code in Run() function to ensure that.
protected override void Run()
{
this.Engine.Log(LogLevel.Verbose, "Running the TestBA.");
MessageBox.Show("MBA is loaded");
this.Engine.Quit(0);
}
Ensure you have included the MBA class name in assembly info file.
[assembly: BootstrapperApplication(typeof(TestBA))]
Check your Bootstrapper log file in %temp% location to find the root cause of the error.
I referred this example to start the Bootstrapper application. This may helpful for you.
You are missing some configuration required by Burn to start up the custom BA. If initializing and loading of you BA fails it starts the prerequisite installer. In your case .Net Framework.
You have to add a "BootstrapperCore.config" file as payload in order to get your custom BA running. The BoostrapperCore.config tells the burn engine how to initialize your custom BA.
Your BootstrapperApplicationRef should look like this
<BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
<Payload SourceFile='MyBA.dll' />
<Payload SourceFile='BootstrapperCore.config' />
</BootstrapperApplicationRef>
Content of BootstrapperCore.config file:
<configuration>
<configSections>
<sectionGroup name="wix.bootstrapper"
type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup, BootstrapperCore">
<section name="host"
type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.HostSection, BootstrapperCore" />
</sectionGroup>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
<wix.bootstrapper>
<host assemblyName="MyBA">
<supportedFramework version="v4\Full" />
<supportedFramework version="v4\Client" />
</host>
</wix.bootstrapper>
</configuration>
Write the name of your assembly without extension to attribute "assemblyName".
Also make sure that you add the following entry to the assemblyinfo.cs of your BA Assembly, where MyNamespace.MyBA is the name of the class including the full namespace name which you derived from WiXBootstrapper.BootstrapperApplication
[assembly: BootstrapperApplication(typeof(MyNamespace.MyBA))]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With