【问题标题】:WiX Custom Action - MSI copy itselfWiX 自定义操作 - MSI 复制本身
【发布时间】:2012-07-13 12:42:59
【问题描述】:

有人可以帮我在 MSI 中构建一个自定义操作,它会在成功安装后将自身复制到某个 X 位置。 我已经看到它可以使用 .exe 来完成,但我只想使用 CA.DLL (C#) 来完成,因为这个 exe 将是一个开销。

【问题讨论】:

标签: wix custom-action


【解决方案1】:

这是一个示例 VB 脚本,它将按名称查找已安装的产品并复制 MSI 的缓存副本。这将适用于 Windows 7 及更高版本,因为完整的 MSI 被缓存并且任何嵌入的 cab 文件都保留在 MSI 中。在旧系统上,您只需获取没有有效负载的 MSI。

Dim installer, products, product, productCode
Set installer = Wscript.CreateObject("WindowsInstaller.Installer")

For Each productCode In installer.Products
  If InStr(1, LCase(installer.ProductInfo(productCode, "ProductName")), LCase("My Product Name")) Then Exit For
Next

If IsEmpty(productCode) Then Wscript.Quit 2

Set products = installer.ProductsEx(productCode, "", 7)
filesys.copyFile products(0).InstallProperty("LocalPackage"), "c:\path\to\newcopy.msi"

【讨论】:

    猜你喜欢
    • 2011-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多