Wix and Eventlog

2019-08-21 02:46发布

问题:

I have seen How do you create an event log source using WiX. My question is what is the common use (scenario) of specifying Event Source in Wix? I was thinking that specifying the source would list your application's install/uninstall process under that source in the event log so it would be easy to filter/check but even after doing that the source shows up as MsiInstaller for me. What am I doing wrong or am I misunderstanding the use of util:EventSource?

Here is my code :

          <Component Id="EventLogSettings" Guid="A456420B-21E7-4306-904E-5CD3822193F0">
            <util:EventSource Log="Application" Name="WixSample" SupportsErrors ="yes" SupportsInformationals ="yes" SupportsWarnings ="yes" EventMessageFile="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll" KeyPath="yes"/>
            <!--<?if $(var.Platform) = x64 ?>
            <util:EventSource Log="Application" Name="WixSample" EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR64]EventLogMessages.dll" KeyPath="yes" />
            <?else ?>
            <util:EventSource Log="Application" Name="WixSample" EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll" KeyPath="yes" />
            <?endif ?>-->
          </Component>

As you can see I tried two options. Each of them creates a registry entry in the Computer\HKLM\SYSTEM\CurrentControlSet\services\eventlog\Application\WixSample but I am not sure if I need to reference the WixNetFxExtension. If I do then what about installation of non .net application? What do I do in those cases?

回答1:

You are misunderstanding EventSource. EventSource is used to create a custom source for your application to use in it's logging to the windows event log.

You will always see the install/uninstall of your application show up as MsiInstaller.