Skip to content

Commit 5634104

Browse files
committed
Moved bin and obj directories to the root of the repo
1 parent a762ca7 commit 5634104

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

Directory.Build.props

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<Project>
2+
<Import Project="tooling/Common.props" />
23
<Import Project="tooling/Common$(MSBuildProjectExtension).props" Condition="Exists('tooling/Common$(MSBuildProjectExtension).props')"/>
34
</Project>

Directory.Build.targets

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<Project>
2+
<Import Project="tooling/Common.targets" />
23
<Import Project="tooling/Common$(MSBuildProjectExtension).targets" Condition="Exists('tooling/Common$(MSBuildProjectExtension).targets')" />
34
</Project>

tooling/Common.props

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project>
2+
<!-- Default configuration and platform when not present -->
3+
<PropertyGroup>
4+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
5+
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
6+
</PropertyGroup>
7+
<!-- Build to central folders instead of scattering bin and obj throughout the solution tree -->
8+
<PropertyGroup>
9+
<!--
10+
We include the project file extension by default to avoid unexpected collisions, but drop it for C# and C++ projects since we don't expect them to collide.
11+
-->
12+
<ThisProjectOutputSubdirectory>$(MSBuildProjectFile)</ThisProjectOutputSubdirectory>
13+
<ThisProjectOutputSubdirectory Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(MSBuildProjectName)</ThisProjectOutputSubdirectory>
14+
<ThisProjectOutputSubdirectory Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">$(MSBuildProjectName)</ThisProjectOutputSubdirectory>
15+
16+
<_ProjectTreeRoot>$(MSBuildThisFileDirectory)../</_ProjectTreeRoot>
17+
18+
<BaseOutputPath>$(_ProjectTreeRoot)bin/$(Configuration)-$(Platform)/</BaseOutputPath>
19+
<OutputPath>$(BaseOutputPath)$(ThisProjectOutputSubdirectory)/</OutputPath>
20+
<OutputDir>$(OutputPath)</OutputDir>
21+
22+
<BaseIntermediateOutputPath>$(_ProjectTreeRoot)obj/$(ThisProjectOutputSubdirectory)/</BaseIntermediateOutputPath>
23+
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)-$(Platform)/</IntermediateOutputPath>
24+
25+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
26+
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
27+
</PropertyGroup>
28+
</Project>

tooling/Common.targets

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project>
2+
<!-- Verify each intermediate output directory is only used for a single project -->
3+
<PropertyGroup>
4+
<_RelativeProjectPathFilePath>$(BaseIntermediateOutputPath)RelativeProjectPath.txt</_RelativeProjectPathFilePath>
5+
<_ProjectPathRelativeToIntermediateDirectory>$([MSBuild]::MakeRelative($(BaseIntermediateOutputPath), $(MSBuildProjectFullPath)))</_ProjectPathRelativeToIntermediateDirectory>
6+
</PropertyGroup>
7+
<Target Name="VerifyNoIntermediateDirCollisions" BeforeTargets="ResolvePackageAssets;Build">
8+
<WriteLinesToFile File="$(_RelativeProjectPathFilePath)" Lines="$(_ProjectPathRelativeToIntermediateDirectory)" Condition="!Exists('$(_RelativeProjectPathFilePath)')" />
9+
<ReadLinesFromFile File="$(_RelativeProjectPathFilePath)">
10+
<Output TaskParameter="Lines" ItemName="_ReadProjectPathRelativeToIntermediateDirectory" />
11+
</ReadLinesFromFile>
12+
<Error Condition="'%(_ReadProjectPathRelativeToIntermediateDirectory.Identity)' != '$(_ProjectPathRelativeToIntermediateDirectory)'"
13+
Text="Intermediate output directory collision between '%(_ReadProjectPathRelativeToIntermediateDirectory.Identity)' and '$(_ProjectPathRelativeToIntermediateDirectory)'" />
14+
</Target>
15+
<Target Name="CleanUpRelativeProjectPathFilePath" AfterTargets="Clean">
16+
<Delete Files="$(_RelativeProjectPathFilePath)" />
17+
</Target>
18+
</Project>

0 commit comments

Comments
 (0)