我正在用WiX工具集创建一个windows安装程序。我想用UrlReservation元素进行URL预订,我想获得当前用户和域名。
这就是我所做的:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
xmlns:firext="http://schemas.microsoft.com/wix/FirewallExtension"
xmlns:httpext="http://schemas.microsoft.com/wix/HttpExtension">
<Product Id="*" ... >
<Property Id ="PROP_URL_RESERVATION_DOMAIN_NAME" Value="$(env.USERDOMAIN)" Secure="yes" />
<Property Id ="PROP_URL_RESERVATION_USER_NAME" Value="$(env.USERNAME)" Secure="yes" />
<UI>
<UIRef Id="WixUI_FeatureTree_MyApp" />
</UI>
</Product>
userdomain和username设置正确,但它们是在中编译的(在烛光期间(,然后是常量。但我希望在安装程序启动时使用当前用户和域进行初始化。
您能帮我在安装程序启动时用当前值初始化PROP_URL_RESERVATION_DOMAIN_NAME和PROP_URL_RESERVATION_USER_NAME吗?
感谢
我采用RegistrySearch:
<Property Id ="PROP_URL_RESERVATION_DOMAIN_NAME" Value="DOMAIN" Secure="yes">
<RegistrySearch Id="DomainRegistrySearch"
Root="HKCU"
Key="Volatile Environment"
Name="USERDOMAIN"
Type="raw" />
</Property>
<Property Id ="PROP_URL_RESERVATION_USER_NAME" Value="USER" Secure="yes">
<RegistrySearch Id="UserRegistrySearch"
Root="HKCU"
Key="Volatile Environment"
Name="USERNAME"
Type="raw" />
</Property>