<!--
***********************************************************************************************
Microsoft.Common.props

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <ImportByWildcardBeforeMicrosoftCommonProps Condition="'$(ImportByWildcardBeforeMicrosoftCommonProps)' == ''">true</ImportByWildcardBeforeMicrosoftCommonProps>
        <ImportByWildcardAfterMicrosoftCommonProps Condition="'$(ImportByWildcardAfterMicrosoftCommonProps)' == ''">true</ImportByWildcardAfterMicrosoftCommonProps>
        <ImportUserLocationsByWildcardBeforeMicrosoftCommonProps Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftCommonProps)' == ''">true</ImportUserLocationsByWildcardBeforeMicrosoftCommonProps>
        <ImportUserLocationsByWildcardAfterMicrosoftCommonProps Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCommonProps)' == ''">true</ImportUserLocationsByWildcardAfterMicrosoftCommonProps>
    </PropertyGroup>

    <!-- 
        Import wildcard "ImportBefore" props files if we're actually in a 12.0+ project (rather than a project being
        treated as 4.0)
    -->
    <ImportGroup Condition="'$(MSBuildAssemblyVersion)' != ''">
        <!-- 
            Wildcard imports come from $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props.d folder.
            This is very similar to the same extension point used in Microsoft.Common.targets, which is located in
            the $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ directory. Unfortunately, there
            is already a file named "Microsoft.Common.props" in this directory so we have to have a slightly different
            directory name to hold extensions.
        -->
        <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore\*" Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftCommonProps)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore')"/>
        <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftCommonProps)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore')"/>
    </ImportGroup>

   <!-- 
        In VS 2010 SP1 and VS 2012, both supported for asset compatibility, the MSBuild installed 
        as part of them did not enforce using the local ToolsVersion (4.0) in all cases, but instead 
        just used whatever ToolsVersion was in the project file if it existed on the machine, and 
        only forced 4.0 if that ToolsVersion did not exist.  

        Moving forward, we do want to enforce a single acting ToolsVersion per version of Visual Studio, 
        but in order to approximate this behavior on VS 2010 SP1 and VS 2012 as well, we've redirected 
        the targets:  If we're building using 4.X MSBuild (which doesn't define the new reserved 
        property, MSBuildAssemblyVersion), we'll point right back at the 4.0 targets, which still exist 
        as part of the .NET Framework.  Only if we're using the new MSBuild will we point to the current
        targets. 
   -->
    <PropertyGroup Condition="'$(MSBuildAssemblyVersion)' == '' and ('$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' &gt;= '12.0')">
      <!--
           Reset VisualStudioVersion if it's 12.0+: Should be 10.0 if VS 2010 is installed or 11.0 otherwise, 
           but since we don't have a good way of telling whether VS 2010 is installed, make it 11.0 if 
           VS 2012 is installed or 10.0 otherwise.  The reset should be safe because if it was already 
           set to something (e.g. 11.0 in a VS 2012 command prompt) then MSBuild's internal 
           VisualStudioVersion-defaulting code should never come into the picture, so the only way it could 
           be 12.0+ when building a TV 12.0 project (because we're in this file) using MSBuild 4.5 (because 
           MSBuildAssemblyVersion hasn't been set) is if it's a TV 12.0 project on an empty command prompt. 
      -->
      <VisualStudioVersion Condition="Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props')">11.0</VisualStudioVersion>
      <VisualStudioVersion Condition="!Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props')">10.0</VisualStudioVersion>
    </PropertyGroup>

    <!-- If building using 4.X MSBuild, we want to act like this project is TV 4.0, so override 
         the custom extensibility target locations with the hard-coded 4.0 equivalent. -->
    <PropertyGroup Condition="'$(MSBuildAssemblyVersion)' == ''">
      <CustomBeforeMicrosoftCommonProps Condition="'$(CustomBeforeMicrosoftCommonProps)'==''">$(MSBuildExtensionsPath)\v4.0\Custom.Before.$(MSBuildThisFile)</CustomBeforeMicrosoftCommonProps>
      <CustomAfterMicrosoftCommonProps Condition="'$(CustomAfterMicrosoftCommonProps)'==''">$(MSBuildExtensionsPath)\v4.0\Custom.After.$(MSBuildThisFile)</CustomAfterMicrosoftCommonProps>
    </PropertyGroup>

    <!-- If building using 4.X MSBuild, we want to act like this project is TV 4.0, so import
         Microsoft.Common.props from the 4.0 location, and make sure everything else in here is 
         set up such that if it's defaulted to something there, it won't be overridden here. -->
    <Import Project="$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props" Condition="'$(MSBuildAssemblyVersion)' == '' and Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props')" />

    <PropertyGroup>
      <CustomBeforeMicrosoftCommonProps Condition="'$(CustomBeforeMicrosoftCommonProps)'==''">$(MSBuildExtensionsPath)\v$(MSBuildToolsVersion)\Custom.Before.$(MSBuildThisFile)</CustomBeforeMicrosoftCommonProps>
      <CustomAfterMicrosoftCommonProps Condition="'$(CustomAfterMicrosoftCommonProps)'==''">$(MSBuildExtensionsPath)\v$(MSBuildToolsVersion)\Custom.After.$(MSBuildThisFile)</CustomAfterMicrosoftCommonProps>
    </PropertyGroup>

    <!-- 
         Only import the extension targets if we're actually in a 12.0 project here (rather than one we're attempting 
         to treat as 4.0) OR if the Dev11 Microsoft.Common.props don't exist.  If it's a 12.0 project we're redirecting 
         to 4.0 and the Dev11 Microsoft.Common.props do exist, the extension targets will have been imported already 
         so there's no need to import them twice.
     -->
    <Import Project="$(CustomBeforeMicrosoftCommonProps)" Condition="'$(CustomBeforeMicrosoftCommonProps)' != '' and Exists('$(CustomBeforeMicrosoftCommonProps)') and ('$(MSBuildAssemblyVersion)' != '' or !Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props'))" />

    <!-- This is used to determine whether Microsoft.Common.targets needs to import 
         Microsoft.Common.props itself, or whether it has been imported previously,
         e.g. by the project itself. -->
    <PropertyGroup>
        <MicrosoftCommonPropsHasBeenImported>true</MicrosoftCommonPropsHasBeenImported>
    </PropertyGroup>

    <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' and '$(DefaultProjectConfiguration)' != '' ">$(DefaultProjectConfiguration)</Configuration>
        <Platform Condition=" '$(Platform)' == '' and '$(DefaultProjectPlatform)' != '' ">$(DefaultProjectPlatform)</Platform>
    </PropertyGroup>

    <PropertyGroup>
        <WMSJSProject Condition="'$(WMSJSProject)' == ''">WJProject</WMSJSProject>
        <WMSJSProjectDirectory Condition="'$(WMSJSProjectDirectory)' == ''">JavaScript</WMSJSProjectDirectory>
    </PropertyGroup>

    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.VisualStudioVersion.v*.Common.props" Condition="'$(VisualStudioVersion)' == ''" />

    <!-- 
         Only import the extension targets if we're actually in a 12.0 project here (rather than one we're attempting 
         to treat as 4.0) OR if the Dev11 Microsoft.Common.props don't exist.  If it's a 12.0 project we're redirecting 
         to 4.0 and the Dev11 Microsoft.Common.props do exist, the extension targets will have been imported already 
         so there's no need to import them twice.
     -->
    <Import Project="$(CustomAfterMicrosoftCommonProps)" Condition="'$(CustomAfterMicrosoftCommonProps)' != '' and Exists('$(CustomAfterMicrosoftCommonProps)') and ('$(MSBuildAssemblyVersion)' != '' or !Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props'))" />

    <!-- 
        Import wildcard "ImportAfter" props files if we're actually in a 12.0+ project (rather than a project being
        treated as 4.0)
    -->
    <ImportGroup Condition="'$(MSBuildAssemblyVersion)' != ''">
        <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter\*" Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCommonProps)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter')"/>
        <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftCommonProps)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter')"/>
    </ImportGroup>
</Project>
