WIX:使用 .NET 消息文件创建 EventSource
我正在使用 WIX 为我的应用程序创建一个安装程序。到目前为止一切正常。但是,我试图在安装过程中创建一个新的事件源,但它没有按预期工作。
我已阅读并理解这个问题这里是这样,但我有一个有点不同的情况,其中给定的解决方案似乎无法正常工作。以下操作有所不同:
- 我使用
WixNetFxExtension
来确定是否安装 .NET 3.5 作为启动条件。 - 我正在使用
WixUtilExtension
来配置 32 位/64 位构建的内容,如 此处
我想做的是:使用 32-位框架的事件消息文件进行 32 位安装,否则使用 64 位框架的事件消息文件。
上面链接的 SO 问题中的评论之一建议使用以下内容让系统使用 32 位框架的事件消息文件:
<util:EventSource
Log="Application"
Name="*source name*"
EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll"/>
我修改了它以考虑两种类型的设置:
<?if $(var.Platform) = x64 ?>
<util:EventSource Log="..." Name="..." EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR64]EventLogMessages.dll" />
<?else ?>
<util:EventSource Log="..." Name="..." EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll" />
<?endif ?>
在文件的开头,相同的 < code> 条件有效,相应地更改产品名称和文件夹名称。
在该代码上方的一些行中,我使用以下内容来允许 .NET Framework 检测:
<PropertyRef Id="NETFRAMEWORK35"/>
<PropertyRef Id="NETFRAMEWORK20"/>
<Condition Message="...">
<![CDATA[Installed OR NETFRAMEWORK35]]>
</Condition>
当我运行安装程序时,一切似乎都正常,事件源也被创建,我也可以从我的应用程序中使用它,但是,我仍然得到未找到事件消息文件的信息。检查注册表时,我发现消息文件的路径丢失:
EventMessageFile REG_EXPAND_SZ EventLogMessages.dll
我希望 32 位/64 位框架的路径也存在,但它似乎没有预先考虑。
我在这里做错了什么?
I'm creating an installer for my application using WIX. Everything works fine so far. However, I'm trying to create a new event source during installation and that doesn't work as expected.
I've read and understood this question here on SO, but I have a somewhat different situation in which the given solution does not seem to work properly. The following is done differently:
- I'm using the
WixNetFxExtension
to determine whether .NET 3.5 is installed as a startup condition. - I'm using the
WixUtilExtension
to configure stuff for 32-bit/64-bit builds as it is described here
What I'd like to do is: use the 32-bit framework's event message file when doing a 32-bit install, otherwise use the 64-bit framework's event message file.
One of the comments in the above linked SO question suggests to use the following to have the system use the 32-bit framework's event message file:
<util:EventSource
Log="Application"
Name="*source name*"
EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll"/>
I modified this to account for both types of setups:
<?if $(var.Platform) = x64 ?>
<util:EventSource Log="..." Name="..." EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR64]EventLogMessages.dll" />
<?else ?>
<util:EventSource Log="..." Name="..." EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll" />
<?endif ?>
At the beginning of the file, the same <?if ...
conditional works, changing product- and foldernames accordingly.
Some lines above that code I'm using the following to allow for .NET Framework detection:
<PropertyRef Id="NETFRAMEWORK35"/>
<PropertyRef Id="NETFRAMEWORK20"/>
<Condition Message="...">
<![CDATA[Installed OR NETFRAMEWORK35]]>
</Condition>
When I run the installer, everything seems to work, the event source is created, too, I can also use it from my application, however, I still get the information that the event message file is not found. Inspecting the Registry I found that the path to the message file is missing:
EventMessageFile REG_EXPAND_SZ EventLogMessages.dll
I'd expect the path to the 32-bit/64-bit framework to be present, too, but it doesn't seem to be prepended.
What am I doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚遇到这个问题,您需要
PropertyRef
NETFRAMEWORK20INSTALLROOTDIR
和NETFRAMEWORK20INSTALLROOTDIR64
(还要确保引用 WinNetFxExtension)。I just ran into this, you need to
PropertyRef
NETFRAMEWORK20INSTALLROOTDIR
andNETFRAMEWORK20INSTALLROOTDIR64
(also make sure WinNetFxExtension is referenced).