Oh man, have I been dreading this blog post. I wrote about 3-4 of these Custom Event Log Components last year, and basically I’m having to re-learn it in order to try to describe it, so apologies if the detail is a little light…

Assuming you are using WiX 3.7, you first need to add a reference to WixUtilExtension to your Votive project (the Visual Studio project). First I add a .evtx file so that all the logs are stored here directly so that they are not taking up space in other event logs (if you have particularly verbose logging your sys admins are going to love you for creating your own log file. Be sure to remind them of that…)

This bit goes in the Product.wxs file:

 <DirectoryRef Id="TARGETDIR">
 <Component Id="RegistryEntries" Guid="{6D29EFAC-56EA-4813-98BE-210B2778107F}">
 KeyPath="yes" Action="write"/>

You can then add an EventSource element under a component. I have add both registry entries and event logs as Components.

<Feature Id="ProductFeature" Title="ServiceHost" Level="1">
 <ComponentRef Id="RegistryEntries"/>
 <ComponentGroupRef Id="EventLogs"/>

You may need a reboot of the server once these are installed first time. You definitely need to run the MSI as an admin as we are inserting keys into the Registry. Note that we are removing the registries on an uninstall as leaving them in there creates havoc for when we try to reinstall.

I put this fragment of WiX in it’s own file in the Votive project. It doesn’t make much difference other than making it tidier.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="" xmlns:util="">
 <DirectoryRef Id="INSTALLLOCATION">
 <Component Id="ServiceHost_Event_Log" Guid="{260DFE60-8828-40C2-A124-81D28CD9A6EE}">
 <util:EventSource Log=SvcHostLogs"
 EventMessageFile="C:\Windows\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll" KeyPath="yes"/>

 <ComponentGroup Id="EventLogs">
 <ComponentRef Id="ServiceHost_Event_Log"/>


There are more than one way to do create a Custom Event Log, however this one works for both x64 and x86, as well as for Windows and Web based installers for WiX. I’ve also seen this one copied and pasted by devs for new installers and there have been no complaints. Next week I will be showing you how to set the default size of your custom file.