You need a separate property for the search, and a CA to assign a value to the VS12_ROOT_FOLDER if it exists.
IE: <Fragment> <Property Id="VS12_ROOT " Secure="yes"> <RegistrySearch Id="SearchForVS12RootPath" Root="HKLM" Key="Software\Microsoft\VisualStudio\SxS\VS7" Name="12.0" Type="raw" /> </Property> </Fragment> ... <DirectoryRef Id="TARGETDIR"> <Directory Id="VS12_ROOT_FOLDER" Name="VS12Root"> <Directory Id="VS12_Common7" Name="Common7"> <Directory Id="VS12_IDE" Name="IDE"> <Directory Id="VS12_Extensions" Name="Extensions"> <Directory Id="VS12_ExtensionsMicrosoft" Name="Microsoft"> <Directory Id="VS12_ExtensionsMicrosoftContracts" Name="CodeContracts"> <Directory Id="VS12_ExtensionsMicrosoftContractsVersion" Name="$(var.Version)"> <Component Id='VS12extension.manifestComp' Guid='$(var.VS12VsixManifestCompGuid)'> <Condition> VS12_ROOT </Condition> ... <CustomAction Id="SetVS2013Dir" Directory=" VS12_ROOT_FOLDER" Value="VS12_ROOT" /> -----Original Message----- From: Manuel Fahndrich [mailto:m...@microsoft.com] Sent: Tuesday, September 03, 2013 4:32 PM To: wix-users@lists.sourceforge.net Subject: [WiX-users] problem with conditional component I'm trying to install some files conditionally under VS2013 by using the following snippets of code: <Fragment> <Property Id="VS12_ROOT_FOLDER" Secure="yes"> <RegistrySearch Id="SearchForVS12RootPath" Root="HKLM" Key="Software\Microsoft\VisualStudio\SxS\VS7" Name="12.0" Type="raw" /> </Property> </Fragment> ... <PropertyRef Id="VS12_ROOT_FOLDER"/> ... <DirectoryRef Id="TARGETDIR"> <Directory Id="VS12_ROOT_FOLDER" Name="VS12Root"> <Directory Id="VS12_Common7" Name="Common7"> <Directory Id="VS12_IDE" Name="IDE"> <Directory Id="VS12_Extensions" Name="Extensions"> <Directory Id="VS12_ExtensionsMicrosoft" Name="Microsoft"> <Directory Id="VS12_ExtensionsMicrosoftContracts" Name="CodeContracts"> <Directory Id="VS12_ExtensionsMicrosoftContractsVersion" Name="$(var.Version)"> <Component Id='VS12extension.manifestComp' Guid='$(var.VS12VsixManifestCompGuid)'> <Condition>VS12_ROOT_FOLDER</Condition> <File Id='VS12extension.manifest' Name='extension.vsixmanifest' Source='VS11.extension.vsixmanifest' Vital='yes'/> <File Id='VS12codecontracts_SM.png' Name='codecontracts_SM.png' Source='codecontracts_SM.png' Vital='yes'/> <File Id='VS12codecontracts_project.png' Name='codecontracts_project.png' Source='codecontracts_project.png' Vital='yes'/> <File Id='VS12codecontracts_license.rtf' Name='license.rtf' Source='$(var.License)' Vital='yes'/> </Component> </Directory> </Directory> </Directory> </Directory> </Directory> </Directory> </Directory> </DirectoryRef> The idea is to install some files under the VS installation folder, provided VS 2013 is installed. The code works fine on a machine with VS2013 installed. However, on a machine where VS2013 is not installed, the installer creates a folder on c:\ or d:\ called VS12Root populated with the structure above. The registry on such a machine contains no entry for 12.0 under Software\Microsoft\VisualStudio\SxS\VS7. How can I get Wix to not install anything if the VS12_ROOT_FOLDER property is undefined, or what am I doing wrong? -MaF ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users