1<!--
2***********************************************************************************************
3Microsoft.Common.props
4
5WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6          created a backup copy.  Incorrect changes to this file will make it
7          impossible to load or build your projects from the command-line or the IDE.
8
9Copyright (C) Microsoft Corporation. All rights reserved.
10***********************************************************************************************
11-->
12
13<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
14  <PropertyGroup>
15    <ImportByWildcardBeforeMicrosoftCommonProps Condition="'$(ImportByWildcardBeforeMicrosoftCommonProps)' == ''">true</ImportByWildcardBeforeMicrosoftCommonProps>
16    <ImportByWildcardAfterMicrosoftCommonProps Condition="'$(ImportByWildcardAfterMicrosoftCommonProps)' == ''">true</ImportByWildcardAfterMicrosoftCommonProps>
17    <ImportUserLocationsByWildcardBeforeMicrosoftCommonProps Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftCommonProps)' == ''">true</ImportUserLocationsByWildcardBeforeMicrosoftCommonProps>
18    <ImportUserLocationsByWildcardAfterMicrosoftCommonProps Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCommonProps)' == ''">true</ImportUserLocationsByWildcardAfterMicrosoftCommonProps>
19    <ImportDirectoryBuildProps Condition="'$(ImportDirectoryBuildProps)' == ''">true</ImportDirectoryBuildProps>
20  </PropertyGroup>
21
22  <!--
23        Determine the path to the directory build props file if the user did not disable $(ImportDirectoryBuildProps) and
24        they did not already specify an absolute path to use via $(DirectoryBuildPropsPath)
25    -->
26  <PropertyGroup Condition="'$(ImportDirectoryBuildProps)' == 'true' and '$(DirectoryBuildPropsPath)' == ''">
27    <_DirectoryBuildPropsFile Condition="'$(_DirectoryBuildPropsFile)' == ''">Directory.Build.props</_DirectoryBuildPropsFile>
28    <_DirectoryBuildPropsBasePath Condition="'$(_DirectoryBuildPropsBasePath)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), '$(_DirectoryBuildPropsFile)'))</_DirectoryBuildPropsBasePath>
29    <DirectoryBuildPropsPath Condition="'$(_DirectoryBuildPropsBasePath)' != '' and '$(_DirectoryBuildPropsFile)' != ''">$([System.IO.Path]::Combine('$(_DirectoryBuildPropsBasePath)', '$(_DirectoryBuildPropsFile)'))</DirectoryBuildPropsPath>
30  </PropertyGroup>
31
32  <PropertyGroup Condition="'$(ImportDirectoryBuildProps)' == 'true' and exists('$(DirectoryBuildPropsPath)')">
33    <MSBuildAllProjects>$(MSBuildAllProjects);$(DirectoryBuildPropsPath)</MSBuildAllProjects>
34  </PropertyGroup>
35
36  <Import Project="$(DirectoryBuildPropsPath)" Condition="'$(ImportDirectoryBuildProps)' == 'true' and exists('$(DirectoryBuildPropsPath)')"/>
37
38  <!--
39        Prepare to import project extensions which usually come from packages.  Package management systems will create a file at:
40          $(MSBuildProjectExtensionsPath)\$(MSBuildProjectFile).<SomethingUnique>.props
41
42        Each package management system should use a unique moniker to avoid collisions.  It is a wild-card import so the package
43        management system can write out multiple files but the order of the import is alphabetic because MSBuild sorts the list.
44    -->
45  <PropertyGroup>
46    <!--
47            The declaration of $(BaseIntermediateOutputPath) had to be moved up from Microsoft.Common.CurrentVersion.targets
48            in order for the $(MSBuildProjectExtensionsPath) to use it as a default.
49        -->
50    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">obj\</BaseIntermediateOutputPath>
51    <BaseIntermediateOutputPath Condition="!HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
52    <_InitialBaseIntermediateOutputPath>$(BaseIntermediateOutputPath)</_InitialBaseIntermediateOutputPath>
53
54    <MSBuildProjectExtensionsPath Condition="'$(MSBuildProjectExtensionsPath)' == '' ">$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>
55    <!--
56        Import paths that are relative default to be relative to the importing file.  However, since MSBuildExtensionsPath
57        defaults to BaseIntermediateOutputPath we expect it to be relative to the project directory.  So if the path is relative
58        it needs to be made absolute based on the project directory.
59      -->
60    <MSBuildProjectExtensionsPath Condition="'$([System.IO.Path]::IsPathRooted($(MSBuildProjectExtensionsPath)))' == 'false'">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(MSBuildProjectExtensionsPath)'))</MSBuildProjectExtensionsPath>
61    <MSBuildProjectExtensionsPath Condition="!HasTrailingSlash('$(MSBuildProjectExtensionsPath)')">$(MSBuildProjectExtensionsPath)\</MSBuildProjectExtensionsPath>
62    <ImportProjectExtensionProps Condition="'$(ImportProjectExtensionProps)' == ''">true</ImportProjectExtensionProps>
63    <_InitialMSBuildProjectExtensionsPath Condition=" '$(ImportProjectExtensionProps)' == 'true' ">$(MSBuildProjectExtensionsPath)</_InitialMSBuildProjectExtensionsPath>
64  </PropertyGroup>
65
66  <Import Project="$(MSBuildProjectExtensionsPath)$(MSBuildProjectFile).*.props" Condition="'$(ImportProjectExtensionProps)' == 'true' and exists('$(MSBuildProjectExtensionsPath)')" />
67
68  <!--
69        Import wildcard "ImportBefore" props files if we're actually in a 12.0+ project (rather than a project being
70        treated as 4.0)
71    -->
72  <ImportGroup Condition="'$(MSBuildAssemblyVersion)' != ''">
73    <!--
74            Wildcard imports come from $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props.d folder.
75            This is very similar to the same extension point used in Microsoft.Common.targets, which is located in
76            the $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ directory. Unfortunately, there
77            is already a file named "Microsoft.Common.props" in this directory so we have to have a slightly different
78            directory name to hold extensions.
79        -->
80    <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore\*" Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftCommonProps)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore')"/>
81    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftCommonProps)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore')"/>
82  </ImportGroup>
83
84  <!--
85        In VS 2010 SP1 and VS 2012, both supported for asset compatibility, the MSBuild installed
86        as part of them did not enforce using the local ToolsVersion (4.0) in all cases, but instead
87        just used whatever ToolsVersion was in the project file if it existed on the machine, and
88        only forced 4.0 if that ToolsVersion did not exist.
89
90        Moving forward, we do want to enforce a single acting ToolsVersion per version of Visual Studio,
91        but in order to approximate this behavior on VS 2010 SP1 and VS 2012 as well, we've redirected
92        the targets:  If we're building using 4.X MSBuild (which doesn't define the new reserved
93        property, MSBuildAssemblyVersion), we'll point right back at the 4.0 targets, which still exist
94        as part of the .NET Framework.  Only if we're using the new MSBuild will we point to the current
95        targets.
96   -->
97  <PropertyGroup Condition="'$(MSBuildAssemblyVersion)' == '' and ('$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' &gt;= '12.0')">
98    <!--
99           Reset VisualStudioVersion if it's 12.0+: Should be 10.0 if VS 2010 is installed or 11.0 otherwise,
100           but since we don't have a good way of telling whether VS 2010 is installed, make it 11.0 if
101           VS 2012 is installed or 10.0 otherwise.  The reset should be safe because if it was already
102           set to something (e.g. 11.0 in a VS 2012 command prompt) then MSBuild's internal
103           VisualStudioVersion-defaulting code should never come into the picture, so the only way it could
104           be 12.0+ when building a TV 12.0 project (because we're in this file) using MSBuild 4.5 (because
105           MSBuildAssemblyVersion hasn't been set) is if it's a TV 12.0 project on an empty command prompt.
106      -->
107    <VisualStudioVersion Condition="Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props')">11.0</VisualStudioVersion>
108    <VisualStudioVersion Condition="!Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props')">10.0</VisualStudioVersion>
109  </PropertyGroup>
110
111  <!-- If building using 4.X MSBuild, we want to act like this project is TV 4.0, so override
112         the custom extensibility target locations with the hard-coded 4.0 equivalent. -->
113  <PropertyGroup Condition="'$(MSBuildAssemblyVersion)' == ''">
114    <CustomBeforeMicrosoftCommonProps Condition="'$(CustomBeforeMicrosoftCommonProps)'==''">$(MSBuildExtensionsPath)\v4.0\Custom.Before.$(MSBuildThisFile)</CustomBeforeMicrosoftCommonProps>
115    <CustomAfterMicrosoftCommonProps Condition="'$(CustomAfterMicrosoftCommonProps)'==''">$(MSBuildExtensionsPath)\v4.0\Custom.After.$(MSBuildThisFile)</CustomAfterMicrosoftCommonProps>
116  </PropertyGroup>
117
118  <!-- If building using 4.X MSBuild, we want to act like this project is TV 4.0, so import
119         Microsoft.Common.props from the 4.0 location, and make sure everything else in here is
120         set up such that if it's defaulted to something there, it won't be overridden here. -->
121  <Import Project="$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props" Condition="'$(MSBuildAssemblyVersion)' == '' and Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props')" />
122
123  <PropertyGroup>
124    <CustomBeforeMicrosoftCommonProps Condition="'$(CustomBeforeMicrosoftCommonProps)'==''">$(MSBuildExtensionsPath)\v$(MSBuildToolsVersion)\Custom.Before.$(MSBuildThisFile)</CustomBeforeMicrosoftCommonProps>
125    <CustomAfterMicrosoftCommonProps Condition="'$(CustomAfterMicrosoftCommonProps)'==''">$(MSBuildExtensionsPath)\v$(MSBuildToolsVersion)\Custom.After.$(MSBuildThisFile)</CustomAfterMicrosoftCommonProps>
126  </PropertyGroup>
127
128  <!--
129         Only import the extension targets if we're actually in a 12.0 project here (rather than one we're attempting
130         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
131         to 4.0 and the Dev11 Microsoft.Common.props do exist, the extension targets will have been imported already
132         so there's no need to import them twice.
133     -->
134  <Import Project="$(CustomBeforeMicrosoftCommonProps)" Condition="'$(CustomBeforeMicrosoftCommonProps)' != '' and Exists('$(CustomBeforeMicrosoftCommonProps)') and ('$(MSBuildAssemblyVersion)' != '' or !Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props'))" />
135
136  <!-- This is used to determine whether Microsoft.Common.targets needs to import
137         Microsoft.Common.props itself, or whether it has been imported previously,
138         e.g. by the project itself. -->
139  <PropertyGroup>
140    <MicrosoftCommonPropsHasBeenImported>true</MicrosoftCommonPropsHasBeenImported>
141  </PropertyGroup>
142
143  <PropertyGroup>
144    <Configuration Condition=" '$(Configuration)' == '' and '$(DefaultProjectConfiguration)' != '' ">$(DefaultProjectConfiguration)</Configuration>
145    <Platform Condition=" '$(Platform)' == '' and '$(DefaultProjectPlatform)' != '' ">$(DefaultProjectPlatform)</Platform>
146  </PropertyGroup>
147
148  <PropertyGroup>
149    <WMSJSProject Condition="'$(WMSJSProject)' == ''">WJProject</WMSJSProject>
150    <WMSJSProjectDirectory Condition="'$(WMSJSProjectDirectory)' == ''">JavaScript</WMSJSProjectDirectory>
151  </PropertyGroup>
152
153  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.VisualStudioVersion.v*.Common.props" Condition="'$(VisualStudioVersion)' == ''" />
154
155  <!--
156         Only import the extension targets if we're actually in a 12.0 project here (rather than one we're attempting
157         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
158         to 4.0 and the Dev11 Microsoft.Common.props do exist, the extension targets will have been imported already
159         so there's no need to import them twice.
160     -->
161  <Import Project="$(CustomAfterMicrosoftCommonProps)" Condition="'$(CustomAfterMicrosoftCommonProps)' != '' and Exists('$(CustomAfterMicrosoftCommonProps)') and ('$(MSBuildAssemblyVersion)' != '' or !Exists('$(MSBuildExtensionsPath)\4.0\Microsoft.Common.props'))" />
162
163  <!--
164        Import wildcard "ImportAfter" props files if we're actually in a 12.0+ project (rather than a project being
165        treated as 4.0)
166    -->
167  <ImportGroup Condition="'$(MSBuildAssemblyVersion)' != ''">
168    <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter\*" Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCommonProps)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter')"/>
169    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftCommonProps)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter')"/>
170  </ImportGroup>
171</Project>
172