Properties WiX-将字符串与<;房地产>;在<;?如果?>&书信电报;?还有别的吗?>;陈述

Properties WiX-将字符串与<;房地产>;在<;?如果?>&书信电报;?还有别的吗?>;陈述,properties,wix,Properties,Wix,嘿,伙计们,希望有人能帮我解决这个问题。我试图将属性的值与手动定义的字符串进行比较。 我不确定它是否应该像这样工作。这是我的代码 <Variable Name="VS2013Installed" /> <Variable Name="VS2015Installed" /> <!-- Should Search the Registry for the Keys --> <!-- Searches for the Key of V

嘿,伙计们,希望有人能帮我解决这个问题。我试图将属性的值与手动定义的字符串进行比较。 我不确定它是否应该像这样工作。这是我的代码

    <Variable Name="VS2013Installed" />
    <Variable Name="VS2015Installed" />

<!-- Should Search the Registry for the Keys  -->  

<!-- Searches for the Key of Visual Studio 2013 -->    
<Property Id="VS2013" Secure="yes" >    
      <RegistrySearch Id="SEARCH_VS2010" Type="raw" Root="HKCR" Key="VisualStudio.accessor.12.0\shell\Open\ddeexec\Application" >        
      </RegistrySearch>                    
    </Property>

<!-- Searches for the Key of Visual Studio 2015 -->
    <Property Id="VS2015" Secure="yes" >
      <RegistrySearch Id="SEARCH_VS2015" Type="raw" Root="HKCR" Key="VisualStudio.accessor.14.0\shell\Open\ddeexec\Application" >
      </RegistrySearch>
    </Property>

<!-- Should compare the value of the property with the String-->
    <?if [VS2013] = "VisualStudio.12.0" ?>
      <?define VS2013Installed= "1" ?>
    <?else ?>
      <?define VS2013Installed= "0" ?>
    <?endif?>

<!-- Should compare the value of the property with the String-->
    <?if [VS2015] = "VisualStudio.14.0" ?>
      <?define VS2015Installed= "1" ?>
    <?else ?>
      <?define VS2015Installed= "0" ?>
    <?endif?>

<!-- This Condition is only here to get an Message Window with the values of the variables-->
    <Condition Message="$(var.VS2013Installed)$(var.VS2015Installed)">
          <![CDATA[0 = 1 ]]>       
    </Condition>


作为我得到的条件的结果:0,0

WiX条件编译用于WiX变量。您需要Windows Installer属性的条件。看起来您对设置属性和使用属性表达式有一个控制柄;只需将其设置为所有属性和条件。(不过,您可以使用WiX
define
var


您正在使用WiX工具集构建Windows安装程序包(.msi文件)。Windows Installer软件包是一个关系数据库,您可以通过以下工具直观地看到它。Windows Installer引擎(msiexec)使用数据库对产品上的操作(安装、修复、卸载等)执行标准和自定义操作。操作可以通过Windows Installer属性设置、传递和检索数据。属性通常通过方括号中的名称引用,例如,
[VS2015]
。除了WiX提供的自定义操作(您可以使用它们,也可以不使用它们),安装时发生的一切都是Windows安装程序

WiX变量只是避免WiX源中重复的一种方法。当WiX构建包时,它们被“编译掉”。因此,它们的值是固定的。WiX的条件编译(define、if等)也会在构建时编译掉


在代码中,似乎希望在条件编译语句中使用属性值。在运行msiexec之前,不会设置属性值。因此,您已经找到了另一种使用注册表搜索收集的信息的方法。一种方法可能是,如果您有一个支持VS2015的功能,另一个支持2013的功能,则根据引用属性值的表达式启用或禁用功能。

如果要检测安装了哪些版本的Visual Studio,请查看WiX提供的WixVSExtension,并仅使用它提供的属性


它确实包括VS 2013和2015。

您将如何使用安装了哪些Visual Studio版本的知识?也许是在儿童特征的情况下?请将您的问题显示出来。我在代码中添加了一些注释。我的问题是[VS2013]=“if else语句”中的“VisualStudio.12”返回0。我还测试了VS2015的价值,它包含“VisualStudio.12”。一个使用它的简便示例是for WiX本身。非常感谢。功能中的条件是我的解决方案。