如何找出安装了哪些产品 - 较新的产品已安装 MSI windows [英] how to find out which products are installed - newer product are already installed MSI windows

查看:29
本文介绍了如何找出安装了哪些产品 - 较新的产品已安装 MSI windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过 WIX 创建 MSI -> 我们将它安装在 IIS 上.发生了什么 - 我们已经安装了一些版本的应用程序,比如说 1.8,然后我们安装了版本,比如说 99.0,只是为了测试目的,然后我们卸载了这个 99 版本.然后我尝试安装其他版本并获得:已经安装了较新版本的产品.

I can create MSI via WIX -> we installed it on IIS. What is happening - we had some version of application installed already on let's say 1.8, then we installed version let's say 99.0 just for testing purposes, then we uninstalled this 99 version. Then i tryed to install other version and obtained: A newer version of the product is already installed.

然后我尝试更改产品的升级代码 - 并再次制作高版本,然后卸载并安装较低版本 - 并且效果很好.

Then i tryed following changing upgrade code of product - and make high version again, then uninstall and install lower version - and it worked fine.

所以我觉得我错过了一些东西 - 附加信息是在程序和功能列表中我在卸载后找不到更高的应用程序 - 那么我的问题是安装程序如何评估有更新版本?有关已安装(和用于比较)内容的信息究竟存储在何处以及如何有效且轻松地访问它们?这样我就可以直视了吗?

So i feel i missing something - additional information is that in programs and features list i cannot find that higher application after uninstall - then my question is how installer evaluate that there is newer version? where exactly are informations about what is installed(and are used for comparison) stored and how to effectively and easily access them? so i can look straight on it?

推荐答案

ProductCode 标识特定产品.每次您运送新的替换产品时,它都会发生变化.UpgradeCode 通过在预计版本不断增加的更新产品中使用相同的 UpgradeCode 来定义一系列产品.默认情况下,新产品版本会通过重大升级替换旧产品版本.因为 upgradecode 定义了一个产品系列,Windows 将寻找具有相同 UpgradeCode 的产品,因为相同的 UpgradeCode 意味着相互排斥的产品,使用它们来用新产品替换旧产品.在 WiX 中,主要升级是通过 Majorupgrade 元素完成的,您可能正在使用该元素,因为您会收到安装了较新版本"的消息.如果您想升级"到较低版本,则有一个 AllowDowngrade 选项.

ProductCode identifies a particular product. It changes every time you ship a new replacement product. UpgradeCode defines a series of products by using the same UpgradeCode in a updated products whose versions are expected to continually increase. By default, new product versions replace older product versions with a major upgrade. Because upgradecode defines a product series, Windows will look for products with the same UpgradeCode because identical UpgradeCodes means mutually exclusiv products, using them to replace an older product with a new one. In WiX, major upgrade is done with the majorupgrade element which it appears you may be using because you get that "a newer version is installed" message. There is an AllowDowngrade option there if you want to "upgrade" to a lower version.

产品版本(如文件版本)不仅仅是有用的信息 - 它们被系统使用,并理解新的替换旧的,并且通常返回较低版本是一件坏事,这就是默认行为不允许降级的原因.

Product versions (like file versions) are not just useful information - they are used by the system with the understanding that new replaces old and generally it is a bad thing to go back to lower versions, that's why the default behavior disallows downgrades.

这个脚本可能会有所帮助.它使用 Windows Installer 脚本 API 来枚举所有已安装的产品,显示版本、用户 sid、产品代码等:

This script might help. It uses the Windows Installer scripting API to enumerate all the installed products, showing version, user sid, ProductCode etc:

Option Explicit
Public installer, fullmsg, comp, prod, a, fso, pname, ploc, pid,contxt, sid, psorce, pcache, pvers

Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("prodex.txt", True)

' Connect to Windows Installer object
Set installer = CreateObject("WindowsInstaller.Installer")
a.writeline ("Products")
'on error resume next
For Each prod In installer.ProductsEx("", "", 7)
   pid = prod.ProductCode
   contxt = prod.Context
   sid=prod.usersid
   pname = prod.InstallProperty("ProductName")
   psorce = prod.InstallProperty("InstallSource")
   ploc =prod.InstallProperty("InstallLocation")  
   pcache = prod.InstallProperty("LocalPackage") 
   pvers=prod.InstallProperty("VersionString")
   a.writeline (pid & " " & pname & " " & pvers & " installed at <" & ploc & "> from " & psorce & " Context " & contxt & " Local " & pcache)
Next

这篇关于如何找出安装了哪些产品 - 较新的产品已安装 MSI windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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