将msi路径复制到Windows安装程序时进行存储 [英] Store msi path when it’s copied to windows installer
问题描述
我目前正在开发一个具有Setup Installer项目的C#项目.在安装过程中,是否有任何方法可以访问复制的MSI文件的路径(特别是名称)(该文件将缓存在C:\ Windows \ Installer中)?
我希望将此文件存储在文本文件中的某个位置,以便能够直接从表单中卸载我的应用程序.
卸载 :无需直接访问该文件,有很多方法可以不使用缓存的文件名进行卸载:
链接 :
I’m currently developing a C# project that has a Setup Installer project. During the installation process, is there any way to access the path (especially the name) of the copied MSI file (it gets cached in C:\Windows\Installer) ?
I would like to store this somewhere in a text file in order to be able to uninstall my application directly from within a Form.
解决方案Uninstall: There is no need to access that file directly, there are plenty of ways to uninstall without using the cached file name: Uninstalling an MSI file from the command line without using msiexec.
The easiest is just to uninstall by product code:
msiexec.exe /x {PRODUCT-CODE-1111-1111-11111111111X}
And you can uninstall by upgrade code (2), or by name:
You are not trying to uninstall the application that is running from its own GUI are you? :-) Breaking the law. Breaking the law. Wouldn't try that.
LocalPath: There are also several ways to retrieve that local cache path via the 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
Links:
这篇关于将msi路径复制到Windows安装程序时进行存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!