How do you create an event log source using WiX

半城伤御伤魂 提交于 2019-11-26 18:47:07

Wix has out-of-the-box support for creating event log sources.

Assuming you use Wix 3, you first need to add a reference to WixUtilExtension to either your Votive project or the command line. You can then add an EventSource element under a component :

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <Component ...>
        ...
        <util:EventSource Log="Application" Name="*source name*"
           EventMessageFile="*path to message file*"/>
        ...
    </Component>

If this is a .NET project, you can use EventLogMessages.dll in the framework directory as the message file.

Gordon

Just to save people some time - if you are trying to use the Application log and the .NET messages you can cut paste the below code:

<Util:EventSource
 xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
 Name="ROOT Builder"
 Log="Application"
 EventMessageFile="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll"
/>

NOTE: the path above is now correct..

How about the more flexible stuff built in:

EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll"

or

EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR]EventLogMessages.dll"

And

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