views:

2736

answers:

3

I'm creating an installer for a website that uses a custom event log source. I would like our WiX based installer to create that event log source during installation.

Does anyone know the best way to do this using the WiX framework.

+12  A: 

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"&gt;

    <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.

Paul Lalonde
[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll
David Gardiner
If you use the WixNetFxExtension, you can use [NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll
Wim Coenen
Just a warning for anyone trying Wim's suggestion; properties can't depend upon the result of other search properties (which `NETFRAMEWORK*` are). Just spent ages trying to figure out why a `DirectorySearch` using `NETFRAMEWORK40CLIENTINSTALLROOTDIR` wasn't working... :P
Porges
+2  A: 

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.5072\EventLogMessages.dll"
/>
Gordon
A: 

Careful, Gordon's reply has the wrong path! Try this:

EventMessageFile="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll"

dan