Search code examples
wix

Wix toolset doesn't create eventlog entry


I add the Util:EventSource element to my Product.wxs ref to this stackoverflow post.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
     xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="*" Name="FileDeletionRecordServiceSetup" Language="1033" Version="1.0.0.0" Manufacturer="HP GIS" UpgradeCode="7ec63c63-ad12-4cc7-bf7e-138caa10380f">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes" />

    <Feature Id="ProductFeature" Title="FileDeletionRecordServiceSetup" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <UI>
      <UIRef Id="WixUI_InstallDir" />
    </UI>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="FileDeletionRecordService" />
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <Component Id="svcInstallation" Directory="INSTALLFOLDER">
      <File Id="FileDeletionRecordServiceEXE" Source="FileDeletionRecordService.exe"  KeyPath="yes"/>
      <ServiceInstall
        Id="ServiceInstaller"
        Type="ownProcess"
        Name="FileDeletionRecordService"
        DisplayName="FileDeletionRecordService"
        Description="Record file deletion for specified directory"
        Start="auto"
        Account="NT AUTHORITY\LocalService"
        ErrorControl="normal"
      />
      <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="FileDeletionRecordService" Wait="yes" />
    </Component>
  </Fragment>

  <Fragment>
    <Component Id="cmpEventLog" Directory="INSTALLFOLDER">
      <Util:EventSource
       Name="FileDeletionRecordSource"
       Log="FileDeletionRecordService"
       EventMessageFile="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll" />
    </Component>
  </Fragment>
</Wix>

It doesn't create the eventlog entry and the install process didn't show any error. Then I tried another approach from this article. But still not working too.

I tried to install with msiexec /i FileDeletionRecordServiceSetup.msi /l*v install.log but didn't see any log that seems relevant (or perhaps I don't know what specifically to find). (The log is too long to attach so not going to include it here)

I think my wix version is 3.1 (In wixproj, the project version is 3.1)


Solution

  • Rob Mensching answered the issue in my another SO post. Basically, I should bundle my components in a ComponentGroupRef and add to Feature so they can actually be included within installation.