Freigeben über


WiX v3 syntax for detecting the CLR.

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.

Comments

  • Anonymous
    October 17, 2006
    Your guys are great!  Thnaks for all the help.

  • Anonymous
    October 17, 2006
    A link to the full list of 'autodetected' products would be most appreciated. Did the msbuild task dissapear? I can't seem to find wixtasks.dll in the latest release? Otherwize, Wix 3.0 rocks :)

  • Anonymous
    October 18, 2006
    I've listed the 'autodetected' products I found here: http://mostlytech.blogspot.com/2006/10/list-of-wix3-autodetected-products.html Oh, and wixtasks.dll & wix.targets aren't missing, they just goe directly to c:program filesmsbuildmicrosoftwixv3.0 or $(MSBuildExtensionsPath)MicrosoftWiXv3.0 in MSBuild speak... (presumably if you install "MSBuild support")

  • Anonymous
    October 19, 2006
    Thank you for the information, Rob. But there is something in your last paragraph that disturbs me a little bit. Here's what : I actually read that blog entry back then and therefore I remembered the answer to the quiz. However, I find it worrisome that even when using such a powerful tool as WiX, one still has to memorize such oddities. I mean, if my app has a prereq it sounds obvious I don't want to require it to uninstall the app. Why can't WiX implement this for me ? Do you think it is a fair analogy to say that if Orca is like an hex editor then WiX would be MASM ? I.e. powerful for experts but every bit as dangerous ?

  • Anonymous
    October 21, 2006
    I'm not sure if you forgot, but the code for this is also in 2.0.4415's NetFxExtension.wxs, so this should also work in that version.