2015-01-15 108 views
0

msiexec/i myproduct.msi LANG = 1。如何在简单的WIX msi中传递命令行参数?

我没有bootstraper项目,我有简单的Product.wxs文件的wix项目。如果lang = 1,我不想执行3级功能。根据郎参数我想设置一个变量来设置系统登录值既然你知道你需要在运行该注册表项被写入到HKLM或HKCU

<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> 

回答

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> 
+0

WHE例如,msiexec/i install.msi ADDLOCAL = ProductFeature,MyFeatureBHJ –

+0

您是否将嵌套功能(“MyFeatureBHJ”和“MyFeatureBHJttgj”)移出父功能“ProductFeature”? – Isaiah4110

+0

检查更新,您的功能列表应该看起来像这样。然后,您应该使用ADDLOCAL属性来告诉您要使用1和2还是1和3的所有功能。 – Isaiah4110

0

你是正确的,你的回答应该工作,thanks.But于我而言,当我在命令行传递到安装特征 “U”,将其设置变量是HKLM代替HKCU

MSIEXEC/I OfficeAddInSetup.msi ADDLOCAL = “U”

<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>