如何根据之前安装的版本选择“Everyone”/“Just Me”?

发布于 2024-09-13 08:31:11 字数 62 浏览 5 评论 0原文

使用 Visual Studio 安装项目。我想将“每个人/只有我”的选择更改为与先前安装期间选择的用户相同。

Using Visual Studio setup project. I'd like to change Everyone / Just Me choice to the same as the user selected during previous installation.

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

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

发布评论

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

评论(2

月亮坠入山谷 2024-09-20 08:31:11

终于想通了。使用 VBScript 自定义操作。

Dim myUpgradeCode
myUpgradeCode = "{6EFB1553-7F4F-4E26-A32B-E2F0F8E11CA9}"

Dim justMe
justMe = False

'AssignmentType 
'   Equals 0 if product is advertised or installed per-user. 
'   Equals 1 if product is advertised or installed per-machine for all users.

Set products = Session.Installer.RelatedProducts( myUpgradeCode )
For Each product In products
    astp = CLng(Session.Installer.ProductInfo(product, "AssignmentType"))
    If astp = 0 Then
        justMe = True
    End If
Next

If JustMe Then
    Session.Property("ALLUSERS") = ""
Else
    Session.Property("ALLUSERS") = "1"
End If

并在 AppSearch 之前执行。

完毕!

Finally figured it out. Used a VBScript Custom Action.

Dim myUpgradeCode
myUpgradeCode = "{6EFB1553-7F4F-4E26-A32B-E2F0F8E11CA9}"

Dim justMe
justMe = False

'AssignmentType 
'   Equals 0 if product is advertised or installed per-user. 
'   Equals 1 if product is advertised or installed per-machine for all users.

Set products = Session.Installer.RelatedProducts( myUpgradeCode )
For Each product In products
    astp = CLng(Session.Installer.ProductInfo(product, "AssignmentType"))
    If astp = 0 Then
        justMe = True
    End If
Next

If JustMe Then
    Session.Property("ALLUSERS") = ""
Else
    Session.Property("ALLUSERS") = "1"
End If

And executed it before AppSearch.

Done!

丢了幸福的猪 2024-09-20 08:31:11

您可以在安装过程中将 ALLUSERS MSI 属性的值保存到注册表中明确定义的位置。然后,您可以在升级时查询该值并采取相应措施。

您还可以使用 MSI api 检查您的产品是否安装在每台计算机或每用户上下文中。为此,您可以调用 MsiEnumProductsEx< /code>函数并查看您的产品是否出现在任一安装上下文中。

You can save the value of the ALLUSERS MSI property to a well-defined location in the Registry during installation. You can then query that value when you upgrade and act accordingly.

You can also use the MSI api to check whether your product is installed for in a per-machine or per-user context. To do so you would call the MsiEnumProductsEx function and see whether your product appears in either installation context.

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