Duane Johnson asked how to use WiX v3 to detect the CLR. Extensions in WiX v3 are far more powerful than they were in WiX v2. Unfortunately, to enable the new features a few things moved around.
So, let’s say you wanted to to ensure that the .NET Framework 2.0 is already installed. All you have to do is add the following to your setup source code somewhere under the Product element:
<PropertyRef Id="NETFRAMEWORK20"/> <Condition Message="The .NET Framework 2.0 must be installed"> Installed OR NETFRAMEWORK20 </Condition>
To compile that snippet (and answer Duane’s question) using the WiX v3 toolset, you’d do the following:
candle -ext WixNetFxExtension my.wxs light -ext WixNetFxExtension my.wixobj
That should create “my.msi” that will only install if you have the .NET Framework 2.0 already installed. We continue to grow the list of Properties that the WiX toolset handles for you automatically. For example, we already have searches for many of the Microsoft Office SKUs and Visual Studio as well. We’re also always looking for more built-in searches so if you have them and would like to contribute them to the community, send email to wix-devs @ lists.sourceforge.net.
Finally, for the intrepid reader at home, do you know why I OR’d the “Installed” Property into the LaunchCondition example above? When you think you know, check out this previous blog entry for the answer.