伙计们希望有人能帮我解决这个问题。我试图将属性的值与手动定义的字符串进行比较。我不知道它是否应该像这样工作--这是我的准则。
<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
发布于 2015-09-11 17:46:50
WiX条件编译用于WiX变量。您需要Windows安装程序属性的条件。看起来您有一个设置属性和使用属性表达式的句柄;只需将其全部设置为属性和条件即可。(不过,您可以使用WiX define
和var
。)
您正在使用WiX工具集来构建包(.msi文件)。Windows包是一个关系数据库,您可以通过InstEd这样的工具直观地看到它。Windows安装程序引擎(msiexec)使用数据库对产品上的操作(安装、修复、卸载等)执行标准和自定义操作。操作可以通过Windows属性设置、传递和检索数据。属性通常通过方括号中的名称引用,例如[VS2015]
。除了WiX提供的自定义操作(可能使用或不使用)外,安装时发生的一切都是Windows。
WiX变量只是避免WiX源代码中重复的一种方法。当WiX构建包时,它们会被“编译掉”。所以,他们的价值是固定的。WiX的条件编译(定义、如果等)也是在构建时编译掉的.
在代码中,您似乎希望在条件编译语句中使用属性值。在msiexec运行之前,不设置属性值。因此,您已经找到了另一种方式使用您正在收集的信息与注册表搜索。如果您有一个支持VS2015的特性和另一个支持2013年的特性,一种方法可能是基于引用属性值的表达式启用或禁用特性。
发布于 2015-09-12 18:08:55
如果要检测安装了哪个版本的Visual,请查看WiX提供的WixVSExtension,只需使用它提供的属性即可。
http://wixtoolset.org/documentation/manual/v3/customactions/wixvsextension.html
它还包括VS 2013和2015年。
https://stackoverflow.com/questions/32527232
复制相似问题