使用 Windows-Installer 了解 GUIDS、更新和补丁

发布于 2024-08-11 05:22:39 字数 507 浏览 6 评论 0原文

我正在学习 Windows-Installer 和 Wix,并且有许多与其工作原理相关的问题:

  1. 如果组件 GUID 发生更改,但组件中存在相同的文件,那么重大升级时会发生什么情况?文件会被替换吗?
  2. 如果从产品中删除某个组件,重大升级时相关文件会发生什么情况?卸载时原始文件会被删除吗?
  3. 我是否正确地说,主要升级将替换所有组件中的所有文件,无论文件的程序集版本是否已更改,并且在小更新和次要升级中,它仅在 GUID 相同的情况下替换文件,并且文件的汇编版本已增加?如果文件没有程序集版本(例如 aspx 页面)怎么办?
  4. 假设在不使用安装程序的情况下将产品部署到计算机上。如果您随后创建了一个安装程序,其中组件中的文件与已安装目录中的文件同名,那么如果您尝试安装,这些文件会发生什么情况?他们被替换了吗?
  5. 我是否正确地说,如果我使用像 heat 这样的工具来创建一个包含目录中所有文件的 xml 文件(例如网站),那么您必须保持 GUID 相同(手动或使用脚本) ,或者你只能进行重大升级?

I'm learning about Windows-Installer and Wix, and have a number of questions related to how it works:

  1. If a component GUID changes, but the same files are in the component, what happens on a major upgrade? Do the files get replaced?
  2. If a component is removed from a product, what happens to the associated files on a major upgrade? Do the original files get removed on an uninstall?
  3. Am I correct in saying that a major upgrade will replace all files in all components, regardless of whether the assembly version of the file has changed, and that on small updates and minor upgrades, it only replaces a file if the GUID is the same, and the assembly version of the file has been incremented? What if the file doesn't have an assembly version, like an aspx page?
  4. Suppose that a product was deployed on a machine without using an installer. If you then created an installer, with files of the same name in a component as what's in the installed directory, what happens to those files if you tried an installation? Are they replaced?
  5. Am I correct in saying that if I used a tool like heat to create an xml file with all the files in a directory (like for a website), that you'd have to keep the GUIDs the same (manually or with a script), or you'd only be able to do major upgrades?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌路终见情 2024-08-18 05:22:39

如果组件 GUID 更改,但
组件中存在相同的文件,
重大升级会发生什么?

首先,问题是旧组件是否被卸载。如果您没有将升级配置为卸载产品的先前版本,则该组件将不会被删除(尽管其文件可能会被覆盖)。另请参见问题 2 的回答。

其次,问题是是否会安装新组件。仅当组件的键路径丢失时才会安装该组件。如果密钥路径是版本文件,则较低版本也算作“丢失”。

最后,如果新组件被标记为安装,并且 Windows Installer 遇到与其尝试安装的文件同名的文件,则 文件版本控制规则确定文件是否被替换。例如,版本较高的文件不会被降级。

如果一个组件被从
产品,会发生什么
重大升级时的相关文件?
原始文件是否被删除
卸载?

除非您将正确的条目放入升级表 和 InstallExecuteSequence 告诉 Windows 安装程序删除旧产品,旧组件将被保留。请参阅此

我说的正确吗?
升级将替换所有文件
组件...

否。这取决于是否先删除旧组件,是否安装新组件(取决于密钥路径)以及文件版本控制规则。

假设产品部署在
无需使用安装程序的机器。
如果您随后创建了一个安装程序,
组件中的同名文件
就像安装目录中的内容一样,
如果您这样做,这些文件会发生什么情况
尝试过安装吗?

同样,这取决于组件是否安装,取决于它们的密钥路径和文件版本控制规则。

如果我使用的话,我说得对吗?
像 heat 这样的工具来创建 xml 文件
包含目录中的所有文件
(就像一个网站),你会有
保持 GUID 相同(手动
或使用脚本),否则你只会
能够进行重大升级吗?

正确的。 GUID 是组件的标识,因此如果您更改 GUID,则会存在两个组件(在产品的旧版本和新版本中)将相同的资源安装到相同的目标位置。根据 MSDN,这是一个禁忌:“切勿创建两个以相同名称和目标位置安装资源的组件。”

If a component GUID changes, but the
same files are in the component,
what happens on a major upgrade?

First, the question is whether the old component gets uninstalled. If you don't configure your upgrade to uninstall previous versions of your product, then the component will not be removed (although its files may be overwritten). See also answer to question 2.

Second, the question is whether the new component will be installed. A component is only installed if its keypath is missing. If the keypath is a versioned file, then a lower version also counts as "missing".

Finally, if the new component was marked for installation, and Windows Installer encounters a file with the same name as the one it is trying to install, the File Versioning Rules determine whether the file is replaced or not. For example, a file with a higher version will not be downgraded.

If a component is removed from a
product, what happens to the
associated files on a major upgrade?
Do the original files get removed on
an uninstall?

Unless you put the right entries in the Upgrade table and the InstallExecuteSequence that tells windows installer to remove the old product, the old components will be left alone. See this blog post by Alex Shevchuk for guidance on how to create an installer in wix that removes old versions.

Am I correct in saying that a major
upgrade will replace all files in all
components ...

No. It depends on whether the old component was removed first, whether the new component was installed depending on the keypath, and the file versioning rules.

Suppose that a product was deployed on
a machine without using an installer.
If you then created an installer, with
files of the same name in a component
as what's in the installed directory,
what happens to those files if you
tried an installation?

Again, it depends on whether the components get installed, depending on their keypath, and the file versioning rules.

Am I correct in saying that if I used
a tool like heat to create an xml file
with all the files in a directory
(like for a website), that you'd have
to keep the GUIDs the same (manually
or with a script), or you'd only be
able to do major upgrades?

Correct. The GUID is the identity of a component, so if you would change the GUID there would exist two components (in the old and new version of your product) that installed the same resources to the same target location. And that's a no-no according to MSDN: "Never create two components that install a resource under the same name and target location."

爱冒险 2024-08-18 05:22:39

了解组件规则。它们很容易被破坏,并且 Windows Installer 不强制执行它们。然而,如果你不遵守规则,就会发生奇怪的巫术。

简单的解决方案,坚持每个组件一个文件,并使用 heat 进行编译时 GUID 生成(带有 Guid="*" 的输出使用稳定的算法,它不是随机的)。热量生成 GUID 是随机的,但在编译时由 candle 生成的 GUID 将是稳定的(基于文件名+路径哈希或内存中的某些内容)

如果 Windows 安装程序在安装过程中发现磁盘上已有文件,则它假设该文件是“共享”文件,则会增加该文件的引用计数。只有当引用计数返回到零时,文件才会从磁盘中删除,因此如果文件已经存在,计数可能永远不会返回到零,即使卸载后,您也可能会留下文件。

Learn the Component Rules. They're very easy to break and Windows Installer doesn't enforce them. However if you don't follow the rules, then weird strange voodoo happens.

Easy solution, stick with one file per component and use heat with compile time GUID generation (outputs with Guid="*" uses a stable algorithm, it's not random). Having heat generate GUIDs is random, but GUIDs generated by candle at compile time will be stable (based on filename + path hash or something from memory)

If windows installer finds a file already on disk during install, it will increment the reference count for that file assuming it's a "shared" file. Files are only removed from disk once the reference count returns to zero so if a file already existed, the count may never return to zero and you can get files left lying around even after uninstalling.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文