<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->


<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <Property Id="VS2010_VSIX_INSTALLER_PATH" Secure="yes">
            <RegistrySearch Id="WixVS2010EnvDir" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS" Name="EnvironmentDirectory" Type="directory">
                <FileSearch Id="WixVS2010VsixInstaller" Name="VSIXInstaller.exe" />
            </RegistrySearch>
        </Property>

        <Property Id="VS2012_VSIX_INSTALLER_PATH" Secure="yes">
            <RegistrySearch Id="WixVS2012EnvDir" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\11.0\Setup\VS" Name="EnvironmentDirectory" Type="directory">
                <FileSearch Id="WixVS2012VsixInstaller" Name="VSIXInstaller.exe" />
            </RegistrySearch>
        </Property>

        <Property Id="VS2013_VSIX_INSTALLER_PATH" Secure="yes">
            <RegistrySearch Id="WixVS2013EnvDir" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\12.0\Setup\VS" Name="EnvironmentDirectory" Type="directory">
                <FileSearch Id="WixVS2013VsixInstaller" Name="VSIXInstaller.exe" />
            </RegistrySearch>
        </Property>

        <!-- VS2015 is the latest VSIX at this point in time, so search for that by default. -->
        <Property Id="VS2015_VSIX_INSTALLER_PATH" Secure="yes">
            <RegistrySearch Id="WixVS2015EnvDir" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\14.0\Setup\VS" Name="EnvironmentDirectory" Type="directory">
                <FileSearch Id="WixVS2015VsixInstaller" Name="VSIXInstaller.exe" />
            </RegistrySearch>
        </Property>

        <Property Id="VS_VSIX_INSTALLER_PATH" Secure="yes" />

        <!-- VWD2012 registers differently than the rest of Visual Studio, so search for it in the case VS2012 is missing. -->
        <Property Id="VWD2012_VSIX_INSTALL_ROOT">
            <RegistrySearch Id="Vwd2012Search" Root="HKLM" Key="SOFTWARE\Microsoft\VWDExpress\11.0\Setup\VS" Name="ProductDir" Type="raw" />
        </Property>

        <!-- VWD2013 registers differently than the rest of Visual Studio, so search for it in the case VS2013 is missing. -->
        <Property Id="VWD2013_VSIX_INSTALL_ROOT">
            <RegistrySearch Id="Vwd2013Search" Root="HKLM" Key="SOFTWARE\Microsoft\VWDExpress\12.0\Setup\VS" Name="ProductDir" Type="raw" />
        </Property>

        <!-- VWD2015 registers differently than the rest of Visual Studio, so search for it in the case VS2015 is missing. -->
        <Property Id="VWD2015_VSIX_INSTALL_ROOT">
            <RegistrySearch Id="Vwd2015Search" Root="HKLM" Key="SOFTWARE\Microsoft\VWDExpress\14.0\Setup\VS" Name="ProductDir" Type="raw" />
        </Property>

        <!-- Use the latest VS- or VWD-installed VSIXInstaller.exe. -->
        <SetProperty Action="SetVS2015Vsix" Id="VS_VSIX_INSTALLER_PATH" Value="[VS2015_VSIX_INSTALLER_PATH]" Sequence="both" After="AppSearch">NOT VS_VSIX_INSTALLER_PATH AND VS2015_VSIX_INSTALLER_PATH</SetProperty>
        <SetProperty Action="Vwd2015VsixWhenVSAbsent" Id="VS_VSIX_INSTALLER_PATH" Value="[VWD2015_VSIX_INSTALL_ROOT]\Common7\IDE\VSIXInstaller.exe" Sequence="both" After="SetVS2015Vsix">NOT VS_VSIX_INSTALLER_PATH AND VWD2015_VSIX_INSTALL_ROOT</SetProperty>

        <SetProperty Action="SetVS2013Vsix" Id="VS_VSIX_INSTALLER_PATH" Value="[VS2013_VSIX_INSTALLER_PATH]" Sequence="both" After="Vwd2015VsixWhenVSAbsent">NOT VS_VSIX_INSTALLER_PATH AND VS2013_VSIX_INSTALLER_PATH</SetProperty>
        <SetProperty Action="Vwd2013VsixWhenVSAbsent" Id="VS_VSIX_INSTALLER_PATH" Value="[VWD2013_VSIX_INSTALL_ROOT]\Common7\IDE\VSIXInstaller.exe" Sequence="both" After="SetVS2013Vsix">NOT VS_VSIX_INSTALLER_PATH AND VWD2013_VSIX_INSTALL_ROOT</SetProperty>

        <SetProperty Action="SetVS2012Vsix" Id="VS_VSIX_INSTALLER_PATH" Value="[VS2012_VSIX_INSTALLER_PATH]" Sequence="both" After="Vwd2013VsixWhenVSAbsent">NOT VS_VSIX_INSTALLER_PATH AND VS2012_VSIX_INSTALLER_PATH</SetProperty>
        <SetProperty Action="Vwd2012VsixWhenVSAbsent" Id="VS_VSIX_INSTALLER_PATH" Value="[VWD2012_VSIX_INSTALL_ROOT]\Common7\IDE\VSIXInstaller.exe" Sequence="both" After="SetVS2012Vsix">NOT VS_VSIX_INSTALLER_PATH AND VWD2012_VSIX_INSTALL_ROOT</SetProperty>

        <SetProperty Action="SetVS2010Vsix" Id="VS_VSIX_INSTALLER_PATH" Value="[VS2010_VSIX_INSTALLER_PATH]" Sequence="both" After="Vwd2012VsixWhenVSAbsent">NOT VS_VSIX_INSTALLER_PATH AND VS2010_VSIX_INSTALLER_PATH</SetProperty>
    </Fragment>
</Wix>
