我正在使用 WIX 为我的应用程序创建安装程序.到目前为止一切正常.但是,我试图在安装过程中创建一个新的事件源,但这并没有按预期工作.
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:
我想做的是:在进行 32 位安装时使用 32 位框架的事件消息文件,否则使用 64 位框架的事件消息文件.
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.
上述链接的 SO 问题中的一条评论建议使用以下内容让系统使用 32 位框架的事件消息文件:
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 ?>在文件的开头,相同的 <?if ... 条件起作用,相应地更改产品和文件夹名称.
At the beginning of the file, the same <?if ... conditional works, changing product- and foldernames accordingly.
该代码上方的某些行我使用以下代码来进行 .NET Framework 检测:
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我希望 32 位/64 位框架的路径也存在,但似乎没有预先设置.
I'd expect the path to the 32-bit/64-bit framework to be present, too, but it doesn't seem to be prepended.
我在这里做错了什么?
推荐答案我刚碰到这个,需要PropertyRef NETFRAMEWORK20INSTALLROOTDIR 和 NETFRAMEWORK20INSTALLROOTDIR64(还要确保引用了 WinNetFxExtension).
I just ran into this, you need to PropertyRef NETFRAMEWORK20INSTALLROOTDIR and NETFRAMEWORK20INSTALLROOTDIR64 (also make sure WinNetFxExtension is referenced).
更多推荐
WIX:使用 .NET 消息文件创建 EventSource
发布评论