Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Uninstall event not working for multiple instance in windows installer.
 

Uninstall event not working for multiple instance in windows installer.

I am installing my product multiple instances using instance transform method.

· My product basically a windows service. When I install a instance of my product it will install service with some automatic generated display and service name.

· When I go for another instance , it will detect the already installed service and increment the count 1. I am able to do the earlier mentioned things.

Issue:

· When I try to uninstall each instances , I am expecting the windows service belongs to each instance should be uninstalled. I have written custom code on custom action of uninstall event in windows installer.

· When I uninstall the first instance of product (For example I have installed three instances) the corresponding service is not uninstalled, the uninstall custom action is not fired.

· When I uninstall second instance of product the same problem is happening.

· When I uninstall third (last instance of the product) instance of product, the corresponding windows service uninstalling properly(uninstall custom event is fired).

·

Why this uncontrolled behavior is happening in multiple instance concept. Please help me on this. Awaiting for your valuable reply.

(If you want I will explain in detail what I did.)

rajesh_saj  Wednesday, August 05, 2009 4:53 AM
I don't quite know what the problem is here because (forgetting your custom action issue) this is to be expected.My assumption in what follows is that you did not change any component guids in your MSI file, and based on that this is what I thinkis happening.

You have multiple instances of a product installed, but you don't really have multiple instances of all your files installed. You have a differentproduct instance installed three times but you have identical component instances installed three times,ref counted, and Windows is keeping track of them. What makes this happen is the internal component guids of the files. You should take an MSI log to see the details but this is what I think you're seeing, guessing that you did not do anything with component guids.

I believe you'll find that each product instance is installing files with the the same component guid in all three. So the service component guid is installed three times. Wellthe file is actually installed once but the component guid hasa ref count of three. This is how MSI shares - with component guids.

Each time you uninstall you're just decrementing the ref counterand that component guid is not being uninstalled. When you get to the last one, the ref count is going to become zero and so it will really uninstall rather than just decrement a counter.Also, keep in mind that there is not really an MSIthing called an "uninstall custom action". There are only custom actions that have conditions about whetherthey are to be called or not. The condition on an uninstall custom action generated by Visual Studio is typically "if this component is being uninstalled, call this custom action", and that is why you get called only when the last uninstall is done - that's when the component is finally removed from the system. You'vegot the same kind of effect as if you had put all your files into a merge module and then used that merge module in three separate setups -each file is shared between all the setups.

The big thing here is that a multiple instance of a product is not the same as having multiple separate instances of all the files inside the product where they all have the same component guid in all three instances.I can't tell exactly what your goal was when you used instance transforms (or what's in your transforms), so what problem were you trying to solve?
Anyway,it's easier to see than describe if you look in the Component table of the MSI file and look at all the Component Ids and realise that these guids are the basis of MSI sharing.




Phil Wilson
PhilWilson  Wednesday, August 05, 2009 9:57 PM
I don't quite know what the problem is here because (forgetting your custom action issue) this is to be expected.My assumption in what follows is that you did not change any component guids in your MSI file, and based on that this is what I thinkis happening.

You have multiple instances of a product installed, but you don't really have multiple instances of all your files installed. You have a differentproduct instance installed three times but you have identical component instances installed three times,ref counted, and Windows is keeping track of them. What makes this happen is the internal component guids of the files. You should take an MSI log to see the details but this is what I think you're seeing, guessing that you did not do anything with component guids.

I believe you'll find that each product instance is installing files with the the same component guid in all three. So the service component guid is installed three times. Wellthe file is actually installed once but the component guid hasa ref count of three. This is how MSI shares - with component guids.

Each time you uninstall you're just decrementing the ref counterand that component guid is not being uninstalled. When you get to the last one, the ref count is going to become zero and so it will really uninstall rather than just decrement a counter.Also, keep in mind that there is not really an MSIthing called an "uninstall custom action". There are only custom actions that have conditions about whetherthey are to be called or not. The condition on an uninstall custom action generated by Visual Studio is typically "if this component is being uninstalled, call this custom action", and that is why you get called only when the last uninstall is done - that's when the component is finally removed from the system. You'vegot the same kind of effect as if you had put all your files into a merge module and then used that merge module in three separate setups -each file is shared between all the setups.

The big thing here is that a multiple instance of a product is not the same as having multiple separate instances of all the files inside the product where they all have the same component guid in all three instances.I can't tell exactly what your goal was when you used instance transforms (or what's in your transforms), so what problem were you trying to solve?
Anyway,it's easier to see than describe if you look in the Component table of the MSI file and look at all the Component Ids and realise that these guids are the basis of MSI sharing.




Phil Wilson
PhilWilson  Wednesday, August 05, 2009 9:57 PM

Dear Phil ,

Thank you very much. Actually after i posted this question ,,i was continue to reading your other threads.I could find my exact solution there, i could solve my problem.Now everything working fine.

That post also was talking about what you have replied for me. i just change the component ID of the file which i was using in the uninstall event,everything was solved. Based on that thread i could solve the problem only , But Based on this reply you have given now, i could understand the whole thing, Thanks again.

Regards
Rajesh.

rajesh_saj  Friday, August 07, 2009 4:52 AM

You can use google to search for other answers

Custom Search

More Threads

• Crystal Report on the Server
• How to Deploy c# windows app with msde
• Disabling click once auto update checking still results in auto checking
• admin privileges for vista installer
• Can run CustomAction under user account
• Click Once to Terminal Server Session - Application Shortcut
• Error launching Clickonce app from intranet
• ClickOnce installation dfsvc.exe
• Install Acrobat PDF 7.0 using MSI
• Assembly has not been installed in the GAC