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 :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.