0

I have an NT service that has some perf counters. When I deploy the service using installutil, the perf counters and the service install fine. When I deploy using my msi, that uses ServiceInstall, the service shows up, but the perf counters don't get installed.

I always just assumed that ServiceInstall ran installutil under the covers. Is there some critical difference that would prevent me from installing perf counters?

Wix segment

<ServiceInstall Id='ServiceInstall' ErrorControl='ignore' Type='ownProcess' DisplayName='Service' Description='service' Name='Service' Start='auto' Account='[SERVICEACCOUNT]' Password='[SERVICEACCOUNTPASSWORD]' /> 
<ServiceControl Id='Service' Remove='uninstall' Name='Service' Start='install' Stop='both' Wait='yes' />

Perf counter install

[RunInstallerAttribute(true)]
[RegistryPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
[EnvironmentPermissionAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public sealed class CountersInstaller : Installer
{
    public CountersInstaller()
    {
        Installers.AddRange(Counters.Instance.PerformanceCounterInstallers());
    }
}
Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
user467384
  • 1,137
  • 4
  • 22
  • 38

1 Answers1

0

No, your assumption is not correct. The ServiceInstall does not call InstallUtil under the hood for installing performance counters. Using InstallUtil is generally treated as a bad practice.

Instead, take a look at PerformanceCategory and PerformanceCounter elements. Of course, this will require some coding to transform what you do now with C# into declarative XML form.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
  • I'm curious about that. If my service is already using a version of the .Net framework, why would calling InstallUtil be so bad? It's not adding any additional dependencies that weren't already there, and in this situation it simplifies the deployment. – user467384 Feb 24 '11 at 21:33
  • Take a look at dtf.chm file which is installed together with WiX Toolset. In contains an article called "InstallUtil Notes". It gives some basic idea. Also, you might be interested to see this discussion: http://stackoverflow.com/questions/3241377/wix-service-installer-and-custom-install-events – Yan Sklyarenko Feb 25 '11 at 06:39