如何让 Burn 检测到所需的 .NET 4.5 框架是否已安装,如果未安装,则在启动我的自定义 UI 之前通知用户需要安装 .NET 4.5 才能运行?
如果没有先决条件检查,我的自定义 UI(BootStrapperApplication)将无法加载。
我不想安装,只想提示缺失。
目前被接受的答案实际上并不起作用,因为MSI属性在捆绑包中不可用。
此示例检查.NET Framework 4.6.1。在Wix标记中添加对NetFxExtension和UtilExtension的引用:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
定义一些属性,指示您需要的.NET版本(我通过搜索此存储库找到了发布版本):
<?define NetFx461MinRelease = 394254 ?>
<?define NetFx461WebLink = http://go.microsoft.com/fwlink/?LinkId=671728 ?>
<util:RegistrySearchRef Id="NETFRAMEWORK45"/>
<bal:Condition Message="This product requires .NET Framework 4.6.1, please install it from <a href="$(var.NetFx461WebLink)">$(var.NetFx461WebLink)</a>.">
<![CDATA[NETFRAMEWORK45 >= $(var.NetFx461MinRelease)]]>
</bal:Condition>
<Bundle>
的任何地方),添加以下内容:<bal:Condition Message="Add your message here">NETFRAMEWORK40FULL</bal:Condition>
<?define NetFx40WebLink = http://go.microsoft.com/fwlink/?linkid=182805 ?>
<bal:Condition Message="Microsoft .NET 4 Full Framework is required. Please download and install it from <a href="$(var.NetFx40WebLink)">$(var.NetFx40WebLink)</a> then re-run this installer.">NETFRAMEWORK40FULL</bal:Condition>