Fix dir.props BuildVersionFile override
authorDavis Goodin <dagood@microsoft.com>
Tue, 29 Aug 2017 02:07:57 +0000 (21:07 -0500)
committerDavis Goodin <dagood@microsoft.com>
Tue, 29 Aug 2017 02:07:57 +0000 (21:07 -0500)
The override needs to be before the Build.Common.props import, because BuildVersion.targets is in Build.Common.props and it's what's responsible for importing BuildVersionFile if it exists.

dir.props

index 000efd6..2bb0a7d 100644 (file)
--- a/dir.props
+++ b/dir.props
     <OutputPath Condition="'$(OutputPath)' == ''">$(BinDir)</OutputPath>
   </PropertyGroup>
 
+  <!-- Explicitly set BuildVersionFile before importing common. This is used by BuildVersion.targets. -->
+  <PropertyGroup Condition="'$(OfficialBuildId)' != ''">
+    <BuildVersionFile>$(BaseIntermediateOutputPath)BuildVersion-$(OfficialBuildId).props</BuildVersionFile>
+  </PropertyGroup>
+
   <!-- Import Build tools common props file where repo-independent properties are found -->
   <Import Condition="Exists('$(ToolsDir)Build.Common.props')" Project="$(ToolsDir)Build.Common.props" />
 
     <PackageIndex Include="$(PackageIndexFile)" />
   </ItemGroup>
 
-  <PropertyGroup Condition="'$(OfficialBuildId)' != ''">
-    <BuildVersionFile>$(BaseIntermediateOutputPath)BuildVersion-$(OfficialBuildId).props</BuildVersionFile>
-  </PropertyGroup>
-
   <!-- Use Roslyn Compilers to build -->
   <Import Project="$(RoslynPropsFile)" Condition="'$(RunningOnUnix)'!='true' and Exists('$(RoslynPropsFile)') and '$(UseRoslynCompilers)'!='false'" />
   <Import Project="$(RoslynPropsFile)" Condition="'$(RunningOnUnix)'=='true' and Exists('$(RoslynPropsFile)')" />