I'm trying to create a mso with wixtoolset 4, unfortunately most examples/documentation is for wixtoolset 3 and I'm currently unable to succesfully add a condition.
I have installed the bal extension nuget package
Product.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>
Condition.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>
So I thought that I can somehow reference the whole fragment but his has been deprecated since long.
I then tried to just add it to my <Fragment>
in ExampleComponents.wxs
which is referenced in Product.wxs
which handles the files to include in the 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>
There are so called bundles
but this seems like a real overkill for what I want and I wasn't able to figure out how to put it together.
How can I reference this Condition so it's properly evaluated during install?
Yes, I know that the condition will always evaluate to false
that's the point, for testing
You want a launch condition, which you can author using the Launch
element.