C#代码卸载installshield安装程序 [英] C# code to uninstall the installshield setup

查看:215
本文介绍了C#代码卸载installshield安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我已经使用Installshield进行了设置. (Setup.exe).
  2. 我希望C#代码使用Installshield安装程序产品代码来卸载该exe.
  3. 而且,我必须知道为什么在尝试手动卸载时exe无法卸载.它会触发回滚.
  4. 我的日志文件看起来像这样.有什么问题吗?

注意:我已经在Installshield设置中附加了MergeModule(MSM).

Note: I have attached the MergeModule(MSM) in my Installshield setup.

推荐答案

日志记录&调试 :如果您的设置在卸载过程中回滚,请检查MSI日志文件.您似乎有一个日志文件,因此请在其中搜索 "Value 3" . 此答案中介绍了有关MSI日志记录和调试的技巧 .

共享的组件 :组件可以由已安装的多个产品共享.除非只有一个产品注册为客户端",否则在卸载期间将不会删除这些组件.您可以使用此VBScript确定哪些产品共享该组件.建议您将其保存到文本文件并从桌面运行.从问题中显示的日志文件中输入组件GUID:

Shared Components: Components can be shared by several products that are installed. These components will not be removed during uninstallation unless there is only one product registered as a "client". You can determine what products share the component using this VBScript. Recommend you save it to a text file and run from your desktop. Input the component GUIDs from your log file shown in your question:

Dim installer : Set installer = CreateObject("WindowsInstaller.Installer")
Dim counter : counter = 1

' Get component GUID from user
componentguid = Trim(InputBox("Please specify component GUID to look up (sample provided, please replace):", "Component GUID:","{4AC30CE3-6D22-5D84-972C-81C5A4775C3D}"))
If componentguid = vbCancel Or Trim(componentguid) = "" Then
   WScript.Quit(0) ' User aborted
End If

' Get list of products that share the component specified (if any)
Set componentclients = installer.ComponentClients(componentguid)
If (Err.number <> 0) Then
   MsgBox "Invalid component GUID?", vbOKOnly, "An error occurred:"
   WScript.Quit(2) ' Critical error, abort
End If

' Show the products
For Each productcode in componentclients
   productname = installer.productinfo (productcode, "InstalledProductName")
   productlist = productlist & counter & " - Product Code: " & productcode & vbNewLine & "Product Name: " & productname & vbNewLine & vbNewLine
   counter = counter + 1
Next

message = "The below products share component GUID: " & componentguid & vbNewLine & vbNewLine

MsgBox message & productlist, vbOKOnly, "Products sharing the component GUID: "


DumpComponentList.zip :Windows Installer专家 Phil Wilson 还有另一个VBScript,它将所有Windows Installer组件都转储到文本文件中.上面的脚本改编自该脚本,您可以在以下位置找到该脚本: DumpComponentList. zip .


DumpComponentList.zip: Windows Installer Expert Phil Wilson has another VBScript which will dump all Windows Installer components to a text file. The above script is adapted from that script which you can find here: DumpComponentList.zip.

DTF :对于.NET,Windows Installer Win32/COM API具有DTF包装器(Microsoft.Deployment.WindowsInstaller.dll- Tom Blodget使用LINQ来访问Windows Installer信息的答案.

这篇关于C#代码卸载installshield安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆