hawkdernacht
Programmer
I have created a CA for a VS windows installer project. I have done this many times with no issue. My problem is this particular CA does not seem to call the Uninstall function.
Not only does the code currently in the function not seem to acomplish what I want, but when i call a msgbox it does not show, when I try to do a debug.writeline nothing happens. If someone could see the error of my ways or shed some wisdom on this subject i would be greatful, my code is listed below.
Imports System.ComponentModel
Imports System.Configuration.Install
<RunInstaller(True)> Public Class HookInstaller
Inherits System.Configuration.Install.Installer
Private _HookManager As HookManager = Nothing
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
Me._hookmanager = New HookManager
End Sub
'Installer overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
Dim strEntries As String() = Nothing
Dim strEntry As String = Nothing
Dim strParts As String() = Nothing
MyBase.Install(stateSaver)
If MyBase.Context.Parameters.ContainsKey("Install") Then
strEntries = Split(MyBase.Context.Parameters.Item("Install"), "|")
If Not strEntries Is Nothing Then
For Each strEntry In strEntries
strParts = Split(strEntry, ",")
If Not strParts Is Nothing Then
Select Case strParts.Length
Case 3
Me._HookManager.InstallHook(CShort(strParts(0)), strParts(1), CShort(strParts(2)))
Case 4
Me._HookManager.InstallHook(CShort(strParts(0)), strParts(1), CShort(strParts(2)), strParts(3))
Case Is >= 5
Me._HookManager.InstallHook(CShort(strParts(0)), strParts(1), CShort(strParts(2)), strParts(3), strParts(4))
End Select
End If
Next
End If
End If
End Sub
Public Overrides Sub Rollback(ByVal savedState As System.Collections.IDictionary)
Dim strEntries As String() = Nothing
Dim strEntry As String = Nothing
MyBase.Rollback(savedState)
If MyBase.Context.Parameters.ContainsKey("Rollback") Then
strEntries = Split(MyBase.Context.Parameters.Item("Rollback"), "|")
If Not strEntries Is Nothing Then
For Each strEntry In strEntries
Me._HookManager.RemoveHook(strEntry)
Next
End If
End If
End Sub
Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary)
Dim strEntries As String() = Nothing
Dim strEntry As String = Nothing
MyBase.Uninstall(savedState)
If MyBase.Context.Parameters.ContainsKey("Uninstall") Then
strEntries = Split(MyBase.Context.Parameters.Item("Uninstall"), "|")
If Not strEntries Is Nothing Then
For Each strEntry In strEntries
Me._HookManager.RemoveHook(strEntry)
Next
End If
End If
End Sub
End Class
Regaurds
The Nighthawk,
"Don't try to reinvent the wheel, unless you can make it better.
Not only does the code currently in the function not seem to acomplish what I want, but when i call a msgbox it does not show, when I try to do a debug.writeline nothing happens. If someone could see the error of my ways or shed some wisdom on this subject i would be greatful, my code is listed below.
Imports System.ComponentModel
Imports System.Configuration.Install
<RunInstaller(True)> Public Class HookInstaller
Inherits System.Configuration.Install.Installer
Private _HookManager As HookManager = Nothing
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
Me._hookmanager = New HookManager
End Sub
'Installer overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
Dim strEntries As String() = Nothing
Dim strEntry As String = Nothing
Dim strParts As String() = Nothing
MyBase.Install(stateSaver)
If MyBase.Context.Parameters.ContainsKey("Install") Then
strEntries = Split(MyBase.Context.Parameters.Item("Install"), "|")
If Not strEntries Is Nothing Then
For Each strEntry In strEntries
strParts = Split(strEntry, ",")
If Not strParts Is Nothing Then
Select Case strParts.Length
Case 3
Me._HookManager.InstallHook(CShort(strParts(0)), strParts(1), CShort(strParts(2)))
Case 4
Me._HookManager.InstallHook(CShort(strParts(0)), strParts(1), CShort(strParts(2)), strParts(3))
Case Is >= 5
Me._HookManager.InstallHook(CShort(strParts(0)), strParts(1), CShort(strParts(2)), strParts(3), strParts(4))
End Select
End If
Next
End If
End If
End Sub
Public Overrides Sub Rollback(ByVal savedState As System.Collections.IDictionary)
Dim strEntries As String() = Nothing
Dim strEntry As String = Nothing
MyBase.Rollback(savedState)
If MyBase.Context.Parameters.ContainsKey("Rollback") Then
strEntries = Split(MyBase.Context.Parameters.Item("Rollback"), "|")
If Not strEntries Is Nothing Then
For Each strEntry In strEntries
Me._HookManager.RemoveHook(strEntry)
Next
End If
End If
End Sub
Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary)
Dim strEntries As String() = Nothing
Dim strEntry As String = Nothing
MyBase.Uninstall(savedState)
If MyBase.Context.Parameters.ContainsKey("Uninstall") Then
strEntries = Split(MyBase.Context.Parameters.Item("Uninstall"), "|")
If Not strEntries Is Nothing Then
For Each strEntry In strEntries
Me._HookManager.RemoveHook(strEntry)
Next
End If
End If
End Sub
End Class
Regaurds
The Nighthawk,
"Don't try to reinvent the wheel, unless you can make it better.