Why does a managed boot application always install the .Net framework regardless of whether the .net framework exists or not?

If WixVariables WixMbaPrereqPackageId and WixMbaPrereqLicenseUrl not added, it will not compile.

Windows Installer XML variable !(wix.WixMbaPrereqPackageId) unknown.
The Windows installer XML variable !(wix.WixMbaPrereqLicenseUrl) unknown.

If these two variables are added, although my test computer has the .NET Framework 4.0 installed, bootstrapper installs the .NET Framework 4.0 each time.

How to avoid installing the .NET Framework when there is already a .NET environment on the destination computer?

The following is 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> 
+4
source share
3 answers

WIX Bootstrapper launches the default installation of the Framework when it cannot load the MBA. Check with a simple message box in which your MBA is loaded or not.

You can use the code below in the Run () function to verify this.

  protected override void Run() { this.Engine.Log(LogLevel.Verbose, "Running the TestBA."); MessageBox.Show("MBA is loaded"); this.Engine.Quit(0); } 

Make sure you include the MBA class name in the assembly information file.

 [assembly: BootstrapperApplication(typeof(TestBA))] 

Check the bootstrapper log file in% temp% to find the root cause of the error.

I mentioned this example to start the Bootstrapper application. This may be useful for you.

+2
source

You are missing any configuration needed by Burn to run a custom BA. If the initialization and loading of your BA fails, it starts the prerequisite installer. In your case .Net Framework.

You must add the file “BootstrapperCore.config” as a payload in order to get your custom BA. BoostrapperCore.config tells the recording 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> 

Contents of the 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> 

Record the name of your assembly with no extension for the assemblyName attribute.

Also make sure you add the following entry to assemblyinfo.cs in your BA assembly, where MyNamespace.MyBA is the class name, including the fully qualified namespace name that you got from WiXBootstrapper.BootstrapperApplication

 [assembly: BootstrapperApplication(typeof(MyNamespace.MyBA))] 
+5
source

A record creates a magazine - what does it say? It looks like your DetectCondition is wrong. Why not use WiX package groups for .NET? They have the right searches and conditions.

0
source

Source: https://habr.com/ru/post/1481903/


All Articles