如何在简单的WIX msi中传递命令行参数?
msiexec/i myproduct.msi LANG=1 我没有bootstraper项目,我有wix项目和simple Product.wxs文件。如果lang=1,我不想执行3级功能。基于lang参数,我试图设置一个变量来设置要写入HKLM或HKCU的注册表值如何在简单的WIX msi中传递命令行参数?,wix,Wix,msiexec/i myproduct.msi LANG=1 我没有bootstraper项目,我有wix项目和simple Product.wxs文件。如果lang=1,我不想执行3级功能。基于lang参数,我试图设置一个变量来设置要写入HKLM或HKCU的注册表值 <Feature Id="ProductFeature" Level="1"> <Condition Level="2">LANG=1</Condition> &l
<Feature Id="ProductFeature" Level="1">
<Condition Level="2">LANG=1</Condition>
<Condition Level="3">LANG=0</Condition>
<Feature Id="MyFeatureBHJ" Title="My Feature BGJ" Level="2">
<?define DllRegLocationGj = "HKCU" ?>
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Feature Id="MyFeatureBHJttgj" Title="My Feature BjjGJ" Level="3">
<?define DllRegLocationGj = "HKLM" ?>
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Feature>
LANG=1
LANG=0
既然您知道运行时需要哪个注册表项,为什么不将嵌套功能(“MyFeatureBHJ”和“MyFeatureBHJttgj”)移出父功能“ProductFeature”?然后直接通过命令行传递功能名称
msiexec /i install.msi ADDLOCAL= ProductFeature ,MyFeatureBHJ
or
msiexec /i install.msi ADDLOCAL= ProductFeature , MyFeatureBHJttgj
更新:因此理想情况下,您的特征元素将如下所示:
<Feature Id="ProductFeature" Level="1">
<!--All components list goes here-->
</Feature>
<Feature Id="MyFeatureBHJ" Title="My Feature BGJ" Level="1">
<!--Component specific to feature BHJ-->
</Feature>
<Feature Id="MyFeatureBHJttgj" Title="My Feature BjjGJ" Level="1">
<!--Component specific to feature BHJttgj-->
</Feature>
您是对的,您的答案应该有效,谢谢。但在我的情况下,当我传入命令行安装功能“U”时,它设置的变量是HKLM而不是HKCU msiexec/i OfficeAddInSetup.msi ADDLOCAL=“U”
当我执行上述操作时,实际上所有功能都已安装。例如,msiexec/i install.msi ADDLOCAL=ProductFeature,MyFeatureBHJDid您将嵌套功能(“MyFeatureBHJ”和“MyFeatureBHJttgj”)移出父功能“ProductFeature”?检查更新,您的功能列表应该是这样的。然后,您应该使用ADDLOCAL属性告诉您想要1&2或1&3的所有功能。谢谢,它应该可以工作。当我们不使用命令行并进行常规安装时,是否跳过功能“MyFeatureBHJ”?是否将级别设置为高于1000是跳过的解决方案?
<Feature Id="U" Title="Excel Add-in" Level="1">
<?define DllRegLocationGj = "HKCU" ?>
<ComponentRef Id="ExcelRegistry_FriendlyName_HKCU" />
</Feature>
<Feature Id="L" Title="Excel Add-in" Level="1">
<?define DllRegLocationGj = "HKLM" ?>
<ComponentRef Id="ExcelRegistry_FriendlyName_HKLM" />
</Feature>
<Component Id="ExcelRegistry_FriendlyName_HKCU">
<RegistryValue Id="ExcelRegistry_FriendlyName_HKCU" Root="$(var.DllRegLocationGj)"
Key="Software\Microsoft\Office\Excel\AddIns\ExcelAddIn"
Name="FriendlyName"
Value=ExcelAddIn"
Type="string" KeyPath="yes" />
</Component>
<Component Id="ExcelRegistry_FriendlyName_HKLM">
<RegistryValue Id="ExcelRegistry_FriendlyName_HKLM" Root="$(var.DllRegLocationGj)"
Key="Software\Microsoft\Office\Excel\AddIns\ExcelAddIn"
Name="FriendlyName"
Value="ExcelAddIn"
Type="string" KeyPath="yes" />
</Component>