我终于弄清楚我做错了什么。我将此归咎于网络上缺少 VB 示例 :-)
在 Install_click 事件(由安装按钮上的用户单击事件执行)中,我未能连接InstallStateChanged事件,如下所示:
AddHandler Application.Current.InstallStateChanged, AddressOf App_InstallStateChanged
我没有意识到这一步是必要的,并假设事件是自己触发的。现在我可以继续将我的安装后操作代码放入 *App_InstallStateChanged* 事件例程中:
Private Sub App_InstallStateChanged(ByVal sender As Object, ByVal e As EventArgs)
'Post-install execution code here
Select Case Application.Current.InstallState
Case InstallState.Installed
DisplayInstalled() 'Routine that executes upon successful install
Case InstallState.InstallFailed
DisplayFailed() 'Routine that executes upon failed install
End Select
End Sub