After diffing the registry changes between the WiX and Installer setups, I think I found the difference.
In the installer, there is an extra CategoryOptions key that is set to 3. After some digging, I found this article (http://blogs.msdn.com/bclteam/archive/2005/03/16/396856.aspx) explaining what exactly that means. Turns out that this is exactly how you set the global vs. private shared memory for counters in version 2 and later. I think I'll be able to hack this registry key into my installer for now, but this might be a good candidate for an update to the utility extension. -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Friday, November 20, 2009 2:15 AM To: 'General discussion for Windows Installer XML toolset.' Subject: Re: [WiX-users] Errors using performance counters after installing with PerformanceCounter/PerformanceCounterCategory The wxs effectively does what is described on the following page: http://msdn.microsoft.com/library/aa371878.aspx, which produces a registration in the system registry of the performance counter. A quick search for me didn't reveal what the implementation of the PerformanceCounterInstaller class does. I must admit that while I have written and read performance counters, it was all pre-.Net, so I don't know the interop (except that there apparently is one). Maybe you could as in some .net forum what relationship there is between the PerformaceCounterInstaller and the MSDN page I found, and how to interoperate those together. -----Original Message----- From: Rich Daniel [mailto:rdan...@microsoft.com] Sent: Thursday, November 19, 2009 9:51 AM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Errors using performance counters after installing with PerformanceCounter/PerformanceCounterCategory I'll give you the wix, the installer code, and the usage all side by side: .wxs fragment: <Component Id="MyApp" Guid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" KeyPath="yes"> <File Name="$(var.MyApp.TargetFileName)" Source="$(var.MyApp.TargetPath)" DiskId="1" /> <File Name="$(var.MyApp.TargetName).pdb" Source="$(var.MyApp.TargetDir)$(var.MyApp.TargetName).pdb" DiskId="1" /> <util:PerformanceCategory Id="MyAppCategory" Name="My Application" Help="Custom performance counters for my application." MultiInstance="yes"> <util:PerformanceCounter Name="My First Counter" Help="The first custom counter for my application." Type="numberOfItems64" /> </util:PerformanceCategory> </Component> .cs fragment (installer): PerformanceCounterInstaller category = new PerformanceCounterInstaller(); category.CategoryName = "My Application"; category.CategoryHelp = "Custom performance counters for my application."; category.CategoryType = PerformanceCounterCategoryType.MultiInstance; CounterCreationData counter = new CounterCreationData(); counter.CounterName = "My First Counter"; counter.CounterHelp = "The first custom counter for my application."; counter.CounterType = PerformanceCounterType.NumberOfItems64; counterInstaller.Counters.Add(counter); .cs fragment (usage): PerformanceCounter counter = new PerformanceCounter(); counter.CategoryName = MyApp.CounterCategoryName; counter.CounterName = MyApp.FirstCounterName; counter.InstanceName = newInstanceName; counter.InstanceLifetime = PerformanceCounterInstanceLifetime.Process; counter.ReadOnly = false; counter.Increment(); // This throws InvalidOperationException -----Original Message----- From: Sebastian Brand (Instyler Software) [mailto:wix+us...@instyler.com] Sent: Wednesday, November 18, 2009 9:25 PM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Errors using performance counters after installing with PerformanceCounter/PerformanceCounterCategory Can you give us the corresponding .wxs code? Best regards, Sebastian Brand Deployment consultant E-Mail: sebast...@instyler.com Instyler Setup - Creating WiX-based MSI installations, elegantly. http://www.instyler.com On 18.11.2009, at 21:13, Rich Daniel wrote: > I'm in the process of migrating my app installation to wix. It's a .NET 2.0 app that currently uses installutil to add some custom performance counters and event log sources. Seeing as how I noticed that WixUtilExtension.dll supplies this functionality from the installer, I thought I'd give it a try instead. > > I'm rubbing up against an issue, however. The installation completes just fine, but the moment my app attempts to modify a counter, it goes bang with the following exception: > > System.InvalidOperationException: PerformanceCounterInstanceLifetime.Process is not valid in the global shared memory. If your performance counter category was created with an older version of the Framework, it uses the global shared memory. Either use PerformanceCounterInstanceLifetime.Global, or if applications running on older versions of the Framework do not need to write to your category, delete and recreate it. > > If I believe that error, the way I've defined the counters in my wxs file installs them in the global shared memory (or uses the .NET 1.* approach to install them). Is there a way to tell it to do things the new way instead of the old or should I give up for now and just have some custom actions call installutil once the bits land on the box? > > Thanks > - Rich Daniel > ---------------------------------------------------------------------- > -------- Let Crystal Reports handle the reporting - Free Crystal > Reports 2008 30-Day trial. Simplify your report design, integration > and deployment - and focus on what you do best, core application > coding. Discover what's new with Crystal Reports now. > http://p.sf.net/sfu/bobj-july > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users ---------------------------------------------------------------------------- -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ---------------------------------------------------------------------------- -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users