WIX: Create EventSource using .NET message file

一世执手 提交于 2019-12-30 05:07:06

问题


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:

  1. I'm using the WixNetFxExtension to determine whether .NET 3.5 is installed as a startup condition.
  2. 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?


回答1:


I just ran into this, you need to PropertyRef NETFRAMEWORK20INSTALLROOTDIR and NETFRAMEWORK20INSTALLROOTDIR64 (also make sure WinNetFxExtension is referenced).



来源:https://stackoverflow.com/questions/3590015/wix-create-eventsource-using-net-message-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!