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());
}
}
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.