Wix 为什么无论.Net framework是否存在,托管引导程序应用程序总是安装.Net framework?
如果未添加WixVariablesWix 为什么无论.Net framework是否存在,托管引导程序应用程序总是安装.Net framework?,wix,bootstrapper,Wix,Bootstrapper,如果未添加WixVariableswixmbaprereeqpackageid和wixmbaprereeqlicenseurl,则编译失败 Windows Installer XML变量!(wix.WixMbaPrereqPackageId)未知。 Windows Installer XML变量!(wix.WixMbaPrereqLicenseUrl)未知 如果添加了这两个变量,即使我的测试计算机安装了.NET Framework 4.0,引导程序每次都会安装.NET Framework 4.0
wixmbaprereeqpackageid
和wixmbaprereeqlicenseurl
,则编译失败
Windows Installer XML变量!(wix.WixMbaPrereqPackageId)
未知。Windows Installer XML变量
!(wix.WixMbaPrereqLicenseUrl)
未知
如果添加了这两个变量,即使我的测试计算机安装了.NET Framework 4.0,引导程序每次都会安装.NET Framework 4.0
当目标计算机已安装.NET Framework时,如何避免安装.NET Framework
下面是我的示例代码
<?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引导程序在框架安装无法加载MBA时默认启动。使用简单消息框检查您的MBA是否已加载 您可以在Run()函数中使用以下代码来确保
protected override void Run()
{
this.Engine.Log(LogLevel.Verbose, "Running the TestBA.");
MessageBox.Show("MBA is loaded");
this.Engine.Quit(0);
}
确保已在程序集信息文件中包含MBA类名
[assembly: BootstrapperApplication(typeof(TestBA))]
检查%temp%位置中的引导程序日志文件以查找错误的根本原因
我参考了启动引导程序应用程序的示例。这可能会对您有所帮助。Burn会创建一个日志,它会说什么?听起来你的探测条件是错误的。为什么不使用.NET的WiX包组?它们具有正确的搜索和条件。您缺少Burn启动自定义BA所需的一些配置。如果初始化和加载BA失败,它将启动必备安装程序。在您的例子中是.Net框架 您必须添加一个“BootstrapperCore.config”文件作为有效负载,以便运行自定义BA。BoostrapperCore.config告诉burn引擎如何初始化自定义BA 您的BootstrapperApplicationRef应该如下所示
<BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
<Payload SourceFile='MyBA.dll' />
<Payload SourceFile='BootstrapperCore.config' />
</BootstrapperApplicationRef>
谢谢分享这个伟大的例子,我的问题解决了,我没有在汇编信息文件中添加属性
<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>
[assembly: BootstrapperApplication(typeof(MyNamespace.MyBA))]