【发布时间】:2018-08-23 22:04:19
【问题描述】:
我要求只有在安装了 Framework 4.6 时才允许 WiX 安装程序安装产品。如果不是这种情况,我会向用户显示一条错误消息。
这工作正常,但现在我必须验证是否有以前的版本在 framework 3.5 中运行,我必须让用户知道需要 Framework 4.6。不知何故,我的方法不起作用。将不胜感激一点帮助。这是我在 WiX 中使用的代码:
<PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" />
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED]]>
</Condition>
<PropertyRef Id="NETFRAMEWORK35" />
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[(NETFRAMEWORK35 AND NOT WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED)]]>
</Condition>
在 CustomAction.config 我有:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>
</startup>
更新
将启动条件更改为:
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[(Installed OR (NETFRAMEWORK35 = "#1" AND WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED))]]>
</Condition>
但安装程序所做的只是显示熟悉的“安装向导提前结束”
【问题讨论】:
-
嗯,作为第一步,我会禁用所有自定义操作并重新编译和测试,和/或enable verbose logging 以确定失败的原因。我总是喜欢建议设置开发人员通过使用链接内容中“Globally for all setups on a machine”下的过程来启用自动日志记录(您可能已经这样做了)。然后,当您需要时,
%TEMP%文件夹中总会有一个可用的日志。按修改排序以查找最新日志。 -
好主意...会尝试...
标签: wix .net-framework-version wix3.10