windows-installer - 用于卸载 installshield 设置的 C# 代码
问题描述
- 我已经使用 Installshield 进行了设置。(安装程序.exe)。
- 我希望 c# 代码使用 Installshield 安装产品代码卸载该 exe。
- 而且,我必须知道为什么在尝试手动卸载时exe没有卸载。它触发回滚。
- 我的日志文件看起来像这样。有什么问题吗?
注意:我在我的 Installshield 设置中附加了 MergeModule(MSM)。
解决方案
日志记录和调试:如果您的设置在卸载期间回滚,请检查 MSI 日志文件。你似乎有一个日志文件,所以请搜索它"Value 3"
。此答案中解释了有关 MSI 日志记录和调试的技巧。
共享组件:组件可以由已安装的多个产品共享。这些组件在卸载过程中不会被删除,除非只有一个产品注册为“客户端”。您可以使用此 VBScript 确定哪些产品共享该组件。建议您将其保存到文本文件并从桌面运行。从问题中显示的日志文件中输入组件 GUID:
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。
DTF:对于 .NET,有用于 Windows Installer Win32 / COM API 的 DTF 包装器(Microsoft.Deployment.WindowsInstaller.dll
-此文件与 WiX 一起安装)。这是Tom Blodget 使用 LINQ 访问 Windows Installer 信息的答案。
推荐阅读
- python - 使用 numpy python 计算宏平均 F1 分数(不使用 scikit learn)
- java - java protobuf 的通用 getDefaultInstance()
- go - 如何验证公钥是否匹配私钥签名?
- javascript - React.js:滑块组件的计数器功能无法正常工作
- python - Odoo xmlrpc,不允许修改读取操作
- google-cloud-platform - GCP Pub/Sub:阅读消息时,确认截止日期不起作用
- r - 使用集群反转索引
- c++ - 有没有其他方法可以在没有向量的情况下在 C++ 中填充数组
- assembly - 标签不一致地重新定义了 NASM
- android-studio - Android Studio ActivityMain.kt 没有从 activity-main.xml 中找到 TextView、Buttons 等的 ID