Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #490 by using Directory.Build.props #496

Merged
merged 1 commit into from
Mar 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions BaseIntermediateOutputPath.props

This file was deleted.

8 changes: 5 additions & 3 deletions Common.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project=".\GlobalStaticVersion.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Global.props'))\Global.props" />

<!-- If $(EnlistmentRoot) is not set then Directory.Build.props hasn't been imported yet. Import Microsoft.Common.props to get it included. -->
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="'$(EnlistmentRoot)' == '' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<!-- If $(EnlistmentRoot) is still not set, then import Directory.Build.props directly. This can happen when gitlink tries to build (because it uses MSBuild tools version 4.0 and we can't find Microsoft.Common.props) -->
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Directory.Build.props'))\Directory.Build.props" Condition="'$(EnlistmentRoot)' == ''"/>

<PropertyGroup>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down
52 changes: 18 additions & 34 deletions Global.props → Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,31 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Condition="'$(EnlistmentRoot)'==''" Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'BaseIntermediateOutputPath.props'))\BaseIntermediateOutputPath.props" />

<!-- This file (Global.props) must be included into all projects in all solutions of this product. -->
<!-- This file (Directory.Build.props) is automatically included by MSBuild into all projects in this solution. -->
<!-- It defines common build paths and infrastructure. -->
<!-- Other products / repositories using the same build pattern will have an own copy of copy this file -->
<!-- Other products / repositories using the same build pattern will have their own copy of copy this file -->

<!-- Project file location for the Import statement: -->
<!-- * You MUST include this file towards the bottom of each respective project file, * -->
<!-- * BELOW all local definitions, RIGHT ABOVE the targets import. * -->
<!-- * For example, right above this line: * -->
<!-- * <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> * -->

<!-- There are two easy ways to import this file. The shortest way is to write something like: -->
<!-- <Import Project="..\..\Global.props" /> -->
<!-- However, you will need to match the number of "..\" segments to the respective location of each project file in -->
<!-- your sourcce tree. A more robust approach is to include the following code. It can stay the same regardless of -->
<!-- your project file location: -->
<!--
<PropertyGroup Label="Include_Common_Build_Properties">
<CommonBuildPropsLocation>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'EnlistmentRoot.marker'))</CommonBuildPropsLocation>
</PropertyGroup>
<ImportGroup Label="Include_Common_Build_Properties">
<Import Project="$(CommonBuildPropsLocation)\Global.props" />
</ImportGroup>
-->
<Import Project=".\GlobalStaticVersion.props" />

<PropertyGroup>
<!-- The common project structure looks like this: -->
Expand All @@ -37,7 +16,7 @@
<!-- Src\ -->
<!-- .git\ -->
<!-- .nuget\ -->
<!-- Global.props -->
<!-- Directory.Build.props (this file) -->
<!-- SomeProjectFolderA\ -->
<!-- NuGet.config -->
<!-- SomeProjectA.sln -->
Expand All @@ -60,36 +39,41 @@
<!-- No build output or temp files should end up in the Src folder! (barring a few *small* VS temporaries) -->
<!-- -->
<!-- Src MUST contain the EnlistmentRoot.marker file which marks the EnlistmentRoot. -->
<!-- Src also contains the NuGet.config file which ensures that NuGet uses the NuGet.Packages folder. -->

<!-- Src also contains the NuGet.config file which ensures that NuGet uses the NuGet.Packages folder. -->

<EnlistmentRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'EnlistmentRoot.marker'))</EnlistmentRoot>

<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
<BinRoot>$([System.IO.Path]::GetFullPath( $(BinRoot) ))</BinRoot>

<RelativeOutputPathBase>$(MSBuildProjectDirectory.Substring($(EnlistmentRoot.Length)))</RelativeOutputPathBase>

<BaseIntermediateOutputPath>$(EnlistmentRoot)\..\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath>$([System.IO.Path]::GetFullPath( $(BaseIntermediateOutputPath) ))</BaseIntermediateOutputPath>

<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

<OutputPath>$(BinRoot)\$(Configuration)\$(RelativeOutputPathBase)</OutputPath>
<OutputPath>$([System.IO.Path]::GetFullPath( $(OutputPath) ))\</OutputPath>

<!-- Collect all NuGet packages in the same folder for convenience during testing -->
<PackageOutputDir>$(BinRoot)\$(Configuration)\NuGet</PackageOutputDir>

<AppxPackageDir>$(OutputPath)</AppxPackageDir>

<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)\$(RelativeOutputPathBase)</IntermediateOutputPath>
<IntermediateOutputPath>$([System.IO.Path]::GetFullPath( $(IntermediateOutputPath) ))\</IntermediateOutputPath>

<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(EnlistmentRoot)\</SolutionDir>

<PackagesDir>$(EnlistmentRoot)\..\packages</PackagesDir>
<PackagesDir>$([System.IO.Path]::GetFullPath( $(PackagesDir) ))</PackagesDir>
<PackagesDir>$([System.IO.Path]::GetFullPath( $(PackagesDir) ))</PackagesDir>

<!-- Forces EventRegister target to generate ETW manifest file -->
<EtwManifestForceAll>true</EtwManifestForceAll>
<EtwManifestOutDir>$(BinRoot)\$(Configuration)\ETW\</EtwManifestOutDir>

</PropertyGroup>

<PropertyGroup>
<!-- Enable NuGet package restore during build -->
<RestorePackages>true</RestorePackages>
Expand Down
4 changes: 2 additions & 2 deletions Microsoft.ApplicationInsights.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core.Tests", "Core.Tests", "{C2FEEDE5-8CAE-41A4-8932-42D284A86EA7}"
EndProject
Expand All @@ -19,8 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
CodeCov.ps1 = CodeCov.ps1
Common.props = Common.props
Common.targets = Common.targets
Directory.Build.props = Directory.Build.props
dirs.proj = dirs.proj
Global.props = Global.props
GlobalStaticVersion.props = GlobalStaticVersion.props
NuGet.config = NuGet.config
NuGet.targets = NuGet.targets
Expand Down
2 changes: 1 addition & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- This file belongs into the EnlistmentRoot folder next to EnlistmentRoot.marker. -->
<!-- See the comments in Global.props for explanations. -->
<!-- See the comments in Directory.Build.props for explanations. -->
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
Expand Down
4 changes: 0 additions & 4 deletions dirs.proj
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project=".\GlobalStaticVersion.props" />
<PropertyGroup>
<PreReleaseVersion>$([MSBuild]::Divide($([System.DateTime]::Now.Subtract($([System.DateTime]::Parse($(SemanticVersionDate)))).TotalMinutes), 5).ToString('F0'))</PreReleaseVersion>
</PropertyGroup>
<Import Project=".\Global.props" />
<ItemGroup>
<Solution Include="Microsoft.ApplicationInsights.sln" />
</ItemGroup>
Expand Down
11 changes: 1 addition & 10 deletions src/Core/Managed/Core.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<Project>
<!--
Workaround for https://github.com/dotnet/sdk/issues/803
Set BaseIntermediateOutputPath before including Sdk.props
-->
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'BaseIntermediateOutputPath.props'))\BaseIntermediateOutputPath.props" />
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props" Condition="Exists('..\..\..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props')" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />

Expand Down Expand Up @@ -46,7 +40,4 @@

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Common.targets'))\Common.targets" />
<Import Project="..\..\..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.targets" Condition="Exists('..\..\..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.targets')" />

<!-- Part of workaround for https://github.com/dotnet/sdk/issues/803 -->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
11 changes: 1 addition & 10 deletions src/Core/NuGet/Core.NuGet.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<Project>
<!--
Workaround for https://github.com/dotnet/sdk/issues/803
Set BaseIntermediateOutputPath before including Sdk.props
-->
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'BaseIntermediateOutputPath.props'))\BaseIntermediateOutputPath.props" />
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Common.props'))\Common.props" />

<PropertyGroup>
Expand All @@ -23,7 +17,4 @@

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Package.targets'))\Package.targets" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Common.targets'))\Common.targets" />

<!-- Part of workaround for https://github.com/dotnet/sdk/issues/803 -->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>