Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to delete a com+ package during uninstallation


1 reply to this topic

Hemamalini

Hemamalini
  • Members
  • 22 posts

Posted 22 March 2002 - 06:35

Hi All
   Using the ComAdmincatalog object I have created a com+ package through custom action.I don't know how to delete the package during uninstallation of the product.
Please help me out.

Scott Williams

Scott Williams
  • Members
  • 38 posts

Posted 22 March 2002 - 19:03

Here is an edited one I use. I actually have a few apps that I delete and I also capture some of the information on one of the Apps, and I'm just parsing out a DbConstructor string, that is mainly what I edited out.

Code Sample

Sub DeleteCOMPlusApps

Dim Catalog
Dim Applications
Dim AppObject
Dim Components, ComObject

Dim sAppName
Dim sNames
Dim i, x

sAppName = Session.Property("COMPLUSAPP")

'First, we create the catalog object
Set Catalog = CreateObject("COMAdmin.COMAdminCatalog.1")

'just to be safe, shutdown the COM+ app
On Error Resume Next
Catalog.ShutdownApplication(sAppName)
Err.Clear
On Error Goto 0

' Get the Applications collection and populate it
Set Applications = Catalog.GetCollection("Applications")
Applications.Populate


For x = 0 To Applications.Count - 1
If Applications.Item(x).Name = sAppName Then
Call Applications.Remove(x)
Exit For
End If
Next
Applications.SaveChanges

End sub


This grabs the name of your COM+ App from a property and first shuts it down, and then removes it from the Catalog.  This however does NOT uninstall the component and delet its files.  I install mine via a Nested install, but I do this when attempting to upgrade the install because if the app is active you get errors running the install.