Custom install action does not register event log sources

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?=

    Custom install action does not register event log sources

    Hi all,

    Can somebody give me a hint why my custom install action does not register
    event log sources, when I run the MSI package generated by VS2005.

    The same install action DLL executed via installutil.exe registers evrything
    just fine!

    Here's the installer class that I have created:


    Code Snippet
    [RunInstaller(tr ue)]
    public class CustomEventLogI nstaller :
    System.Configur ation.Install.I nstaller
    {
    public CustomEventLogI nstaller()
    {
    InstallSource(S ettings.Default .EventLogName,
    Settings.Defaul t.EventLogSourc eAlertService);
    InstallSource(S ettings.Default .EventLogName,
    Settings.Defaul t.EventLogSourc eSystem);
    InstallSource(S ettings.Default .EventLogName,
    Settings.Defaul t.EventLogSourc eUser);
    InstallSource(S ettings.Default .EventLogName,
    Settings.Defaul t.EventLogSourc eError);
    }

    /// <summary>
    /// Installs the EventLog source.
    /// </summary>
    /// <param name="log">The event log name.</param>
    /// <param name="source">T he source name.</param>
    private void InstallSource(s tring log, string source)
    {
    // Create an instance of an EventLogInstall er.
    EventLogInstall er myEventLogInsta ller = new EventLogInstall er();

    // Unregister the source, if it already exists.
    if (EventLog.Sourc eExists(source) )
    EventLog.Delete EventSource(sou rce);

    // Set the source name of the event log.
    myEventLogInsta ller.Source = source;

    // Set the event log that the source writes entries to.
    myEventLogInsta ller.Log = log;

    // Leave the event log behind after uninstall.
    myEventLogInsta ller.UninstallA ction = UninstallAction .NoAction;

    // Add AutoMonEventLog Installer to the Installer collection.
    Installers.Add( myEventLogInsta ller);
    }
    }


    Any help is greatly appreciated.


    --





Working...