我正在尝试使用 wixtoolset 4 创建一个 mso,不幸的是大多数示例/文档都是针对 wixtoolset 3 的,我目前无法成功添加条件。
我已经安装了 bal 扩展 nuget 包
产品.wxs
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Package Name="MyPackage" Manufacturer="Koch IT" Version="1.0.0.0" UpgradeCode="xxxxxxxx-fcae-496b-b7c9-8cfc36fbc157">
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<MediaTemplate EmbedCab="yes" />
<Feature Id="Main">
<ComponentGroupRef Id="ExampleComponents" />
<ComponentGroupRef Id="RegistryEntries" />
</Feature>
</Package>
</Wix>
条件.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Fragment Id="VSTORUNTIMEREDIST_Fragment">
<Property Id="VSTORUNTIMEREDIST">
<RegistrySearch
Id="VSTORuntimeRedist"
Root="HKLM"
Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R"
Name="Version"
Type="raw" />
</Property>
<bal:Condition Condition="Installed OR VSTORUNTIMEREDIST>=20.0.30319"
Message="The Visual Studio 2010 Tools for Office Runtime is not installed.
Please download and install from
https://www.microsoft.com/en-us/download/details.aspx?id=20479.">
</bal:Condition>
</Fragment>
</Wix>
所以我认为我可以以某种方式引用整个片段,但他的片段早已被弃用了。
然后我尝试将其添加到
<Fragment>
中的 ExampleComponents.wxs
中,Product.wxs
中引用了它,它处理要包含在 msi 中的文件,
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Fragment>
<PropertyRef Id="VSTORUNTIMEREDIST"></PropertyRef>
<bal:Condition Condition="Installed OR VSTORUNTIMEREDIST>=20.0.30319"
Message="The Visual Studio 2010 Tools for Office Runtime is not installed.
Please download and install from
https://www.microsoft.com/en-us/download/details.aspx?id=20479.">
</bal:Condition>
<ComponentGroup Id="ExampleComponents" Directory="INSTALLFOLDER">
<Component Guid="xxxxxxxx-f350-4b51-b08a-7bd7f45412df">
<File Source="MyApp.dll" />
<File Source="MyApp.vsto" />
<File Source="MyApp.dll.manifest" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
有所谓的
bundles
,但这对于我想要的东西来说似乎是一个真正的杀伤力,我无法弄清楚如何将它们组合在一起。
我如何引用此条件以便在安装过程中对其进行正确评估?
是的,我知道条件总是会评估为
false
,这就是测试的重点