tags:

views:

23

answers:

2

I'm creating a WiX-based installer for my .NET-based website.

Part of this website involves the performance counters which I would like to create using the installer (counters require elevated permissions to create, something the website should never have).

I have read the documentation provided by WiX on the subject of installing counters, however it looks aimed at native-code applications and seems like it's more effort than it's worth.

How can I create new performance counters using a WiX installer?

A: 

I've never done perf counters in .net so I'd have to understand what the physical deployment requirements are. From there I could help you translate that into WiX with an eye for best practices in mind.

How To: Use Custom Performance Counters

It seems .NET has a regsvr type pattern implemented by some classes in System.Diagnostics. You could adapt this code with WiX's DTF to create a custom action to create the performance counters but this doesn't feel quite right. Also on that web page is some information that says the counters get registered under CurrentControlSet\Services so it might be possible to just use the Registry tables or ServiceInstall table to do the work without writing a custom action.

Christopher Painter
+1  A: 

The article you reference refers to WiX v2. It is not obvious however which version of WiX toolset you actually use.

WiX v3 has easy-to-use elements PerformanceCategory and PerformanceCounter. We use it in our .NET web application installer to install performance counters we need.

Hope this helps.

Yan Sklyarenko
I'm using v3, so I'll try following the reference here. Are there any examples of its use?
Programming Hero
It is quite straight-forward, that's why a sample is not included in the dist, I suppose. Put PerformanceCategor(y|ies) under Component(s), put PerformanceCounter(s) under PerformanceCategor(y|ies).
Yan Sklyarenko