<?xml version = "1.0" encoding="utf-8"?>
<Project ToolsVersion = "4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <!-- VC++ Redistributable is common across all SxS Toolsets and should, by default, point to the latest in the
         v14x ABI compatible set of releases -->
    <Import Project="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)Microsoft.VCRedistVersion.default.props))" Condition="'$(VCToolsRedistVersion)' == ''" />

    <PropertyGroup>
        <!-- If no files are found in the <Choose> block, we'll default to the latest -->
        <VCToolsVersionLatest>14.50.18.0</VCToolsVersionLatest>
        <VCToolsVersionPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\v145\Microsoft.VCToolsVersion.VC.$(VCToolsVersionLatest).props))</VCToolsVersionPath>
        <!-- Since this release includes a Preview toolset, define MSVCBuildToolsVersionPreview to point to it -->
        <MSVCBuildToolsVersionPreview>14.51</MSVCBuildToolsVersionPreview>
        <MSVCBuildToolsVersionPreviewPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\v145\Microsoft.VCToolsVersion.VC.$(MSVCBuildToolsVersionPreview).props))</MSVCBuildToolsVersionPreviewPath>
    </PropertyGroup>

    <!-- MSVC Side-By-Side Toolset will be searched for in the order they appear here. The first one that exists will be used. -->
    <Choose>
        <When Condition="EXISTS('$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\v145\Microsoft.VCToolsVersion.VC.14.50.18.0.props))')">
            <PropertyGroup>
                <VCToolsVersionPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\v145\Microsoft.VCToolsVersion.VC.14.50.18.0.props))</VCToolsVersionPath>
            </PropertyGroup>
        </When>
    </Choose>

    <!-- Set MSVCPreviewToolsetFound if the MSVC Preview toolset is enabled and the .props file for it exists. -->
    <PropertyGroup>
        <MSVCPreviewToolsetFound Condition="'$(VCToolsVersion)' == '' and '$(MSVCPreviewEnabled)' == 'true' and '$(MSVCBuildToolsVersionPreview)' != '' and EXISTS('$(MSVCBuildToolsVersionPreviewPath)')">true</MSVCPreviewToolsetFound>
    </PropertyGroup>
    
    <!-- Import the determined props file -->
    <Import Project="$(MSVCBuildToolsVersionPreviewPath)" Condition="'$(VCToolsVersion)' == '' and '$(MSVCPreviewEnabled)' == 'true' and '$(MSVCPreviewToolsetFound)' == 'true'" />
    <Import Project="$(VCToolsVersionPath)" Condition="'$(VCToolsVersion)' == '' and '$(MSVCPreviewEnabled)' != 'true'" />
</Project>