WiX:如何在外部设置属性? [英] WiX: How can I set a property externally?

查看:113
本文介绍了WiX:如何在外部设置属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的WiX安装程序中,我有一个UserID的属性,该属性已写入注册表项:

In my WiX installer, I've got a property for a UserID that gets written to a registry key:

<Property Id='UserID' Value='123' />

<Directory Id='TARGETDIR' Name='SourceDir'>
    <Component Id='UserIDComponent' Guid='*'>
        <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' 
                       Type='integer' Value='[UserID]' Name='UserID' />
    </Component>

我想将该属性的值设置为即时下载安装程序的用户的用户ID.因此,当他们去下载时,我将创建每个人都可以得到的基本MSI的副本,将UserID的值设置为下载文件的人的值,这就是他们下载的内容.每个人都将获得相同的安装包,但为其设置了自定义属性.

I'd like to set the value of that property to the User ID of the person downloading my installer on the fly. So when they go to download, I'll just create a copy of the base MSI that everyone gets, set the value of UserID to that of the person downloading the file, and that's what they download. It'll be the same installation package that everyone gets, but with the property custom set for them.

不过,我似乎找不到任何有关如何从外部来源设置WiX MSI属性的资源.我该怎么办?

I can't seem to find any resources on how to set a WiX MSI property from an external source, though. How can I do this?

推荐答案

据我所知,您确实可以从外部"设置属性-必须在所有大写字母中使用该属性名称,才能将其识别为公共属性(不要问我为什么....),然后您可以像这样设置它:

As far as I remember, you can indeed set properties from the "outside" - the property name has to be in all UPPERCASE to be recognized as a public property (don't ask me why....) and then you can set it like this:

msiexec /i C:\Example.msi PROPERTY=VALUE

例如在您的情况下

msiexec /i C:\Example.msi USERID=somevalue

有关使用的信息,请参见 MSDN文档 MSIEXEC的命令行选项

See the MSDN docs on using command line options with MSIEXEC

这篇关于WiX:如何在外部设置属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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