复制到Windows Installer时存储msi路径

问题描述 投票:1回答:1

我目前正在开发一个具有Setup Installer项目的C#项目。在安装过程中,是否有任何方法可以访问复制的MSI文件的路径(特别是名称)(该文件将缓存在C:\ Windows \ Installer中)?

我希望将此文件存储在文本文件中的某个位置,以便能够直接从表单中卸载我的应用程序。

c# windows-installer installer
1个回答
0
投票

[Uninstall:无需直接访问该文件,有很多方法可以不使用缓存的文件名来卸载:Uninstalling an MSI file from the command line without using msiexec

最简单的方法就是卸载by product code

msiexec.exe /x {PRODUCT-CODE-1111-1111-11111111111X}

并且您可以卸载by upgrade code2)或by name


您不是要卸载从其自己的GUI运行的应用程序吗? :-) 触犯法律。触犯法律。不会尝试的。


[LocalPath:还有几种方法可以通过MSI API检索本地缓存路径:

On Error Resume Next
Set installer = CreateObject("WindowsInstaller.Installer")

' The product name you search for:
search = "Windows SDK EULA"

For Each product In installer.ProductsEx("", "", 7)
   name = product.InstallProperty("ProductName")
   cachepath=product.InstallProperty("LocalPackage")
   If name = search Then
      MsgBox name + ": " + cachepath
      Exit For
   End If
Next

Local Cache Path


链接

© www.soinside.com 2019 - 2024. All rights reserved.