Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Properties WIX安装期间基于命令行参数有条件地安装文件_Properties_Wix_Installation_Command Line Arguments_Conditional Statements - Fatal编程技术网

Properties WIX安装期间基于命令行参数有条件地安装文件

Properties WIX安装期间基于命令行参数有条件地安装文件,properties,wix,installation,command-line-arguments,conditional-statements,Properties,Wix,Installation,Command Line Arguments,Conditional Statements,我想在wix安装期间有条件地安装文件,无论是否设置了命令行参数 <Component Id="file.pdb" Guid="SOME-GUID"> <Condition>DEBUG</Condition> <File Id="file.pdb" Source="file.pdb" KeyPath="yes" Vital="no" /> </Component> e、 g.我有以下文件,只有

我想在wix安装期间有条件地安装文件,无论是否设置了命令行参数

    <Component Id="file.pdb" Guid="SOME-GUID">
       <Condition>DEBUG</Condition>
       <File Id="file.pdb" Source="file.pdb" KeyPath="yes" Vital="no" />
    </Component>
e、 g.我有以下文件,只有在设置了调试标志时才会安装

    <Component Id="file.pdb" Guid="SOME-GUID">
       <Condition>DEBUG</Condition>
       <File Id="file.pdb" Source="file.pdb" KeyPath="yes" Vital="no" />
    </Component>

调试

我已经添加了DEBUG属性,并从命令行读取它。但该文件从未安装,我很困惑为什么?

解决了这个问题。下面是我做错了什么以及我做了什么来解决它的解释

我已经创建了一个安装程序(.msi),并使用下面的cmd行args来启动它

msiexec-i prog.msi DEBUGPROPERTY=True

我有几个带有组件的合并模块,这些组件的安装取决于是否设置了此属性,这些组件将属性注入其中,就像这样

<Merge
    Id="SomeID"
    Language="1033"
    SourceFile="Module.msm"
    DiskId="1">
    <ConfigurationData
      Name="debugProperty"
      Value="[DEBUGPROPERTY]" />

我缺少的是合并模块(.msm),我需要以下代码

    <Configuration Name='debugProperty' Format='Text' DefaultValue='[DEBUGPROPERTY]'/>
    <Substitution Table='CustomAction' Row='setDebugProperty' Column='Target' Value='[=debugProperty]'/>
    <CustomAction Id='setDebugProperty' Property='DEBUGPROPERTY' Value='[DEBUGPROPERTY]'/>

    <InstallExecuteSequence>
            <Custom Action='setDebugProperty' Before="LaunchConditions">1</Custom>
    </InstallExecuteSequence>

1.
这使我能够访问此模块内的属性DEBUGPROPERTY,以便限制文件是否在安装时安装,如下所示

<Component Id="File.pdb" Guid="SOME-GUID">
    <Condition>DEBUGPROPERTY</Condition>
    <File Id="File.pdb" Source="File.pdb" KeyPath="yes" Vital="no" />
</Component>

调试属性

现在可以了,如果包含此参数,我可以在安装过程中安装.pdb文件。

您是如何在命令行上设置DEBUG属性的?也许有什么地方不对劲。顺便说一句,您只需要在示例中为
File
元素指定
Source
属性。其余的文件属性可以由wix推断。此外,还可以省略组件guid。Wix将自动生成一个稳定的GUID。我想我可能已经发现了这个问题,现在正在研究。我的文件在合并模块中。我从主wxs那里获得了msi的属性,但是我担心我可能不得不从每个msm那里获得属性。。。现在只需测试我的理论,就会让您知道我的发现。听起来您可能会混淆Windows Installer属性和wix预处理器变量。这就是为什么我问你如何设置调试属性。解决了这个问题。这是因为我没有将cmd行参数传递给单独的模块。我现在将添加我的答案,并提供更多细节供其他人查看