Skip to content

Commit af4327c

Browse files
authored
Use .net SDK's Artifacts layout (#777)
1 parent 71cab7d commit af4327c

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

Directory.Build.props

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
<PropertyGroup Label="Repository Paths">
66
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
77
<SrcPath>$([MSBuild]::NormalizeDirectory($(RepoRoot), 'src'))</SrcPath>
8-
<RepoBinRoot>$([MSBuild]::NormalizeDirectory($(RepoRoot), 'bin'))</RepoBinRoot>
9-
<RepoIntermediateRoot>$([MSBuild]::NormalizeDirectory($(RepoRoot), 'obj'))</RepoIntermediateRoot>
108

119
<!-- This file only exists during an official pipeline build -->
1210
<PipelineVersionAssemblyInfoFilePath>$([MSBuild]::NormalizePath($(RepoRoot), '.version', 'PipelineAssemblyInfo.cs'))</PipelineVersionAssemblyInfoFilePath>
@@ -22,6 +20,20 @@
2220
<AssemblyOriginatorKeyFile>$(RepoRoot)35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
2321
</PropertyGroup>
2422

23+
<!--
24+
Enable Artifacts output layout (https://learn.microsoft.com/en-us/dotnet/core/sdk/artifacts-output)
25+
Benefits of using this layout:
26+
- we no longer own customizing output paths
27+
- The default layout meets most needs that called for custom output paths to begin with
28+
- can be customized further if needed
29+
- folder paths are also much more consistent and predictable
30+
- ArtifactsPivots folder name is normalized to lowercase, allowing for cross-platform compatibility
31+
-->
32+
<PropertyGroup Label="Artifacts output config">
33+
<!-- Allow pipeline to override ArtifactsPath -->
34+
<ArtifactsPath Condition="'$(ArtifactsPath)' == ''">$([MSBuild]::NormalizeDirectory($(RepoRoot), 'artifacts'))</ArtifactsPath>
35+
</PropertyGroup>
36+
2537
<PropertyGroup Label="Nuget Config">
2638
<RestorePackagesPath>$([MSBuild]::NormalizeDirectory($(RepoRoot), 'pkg'))</RestorePackagesPath>
2739
<!-- <RestoreIgnoreFailedSource>true</RestoreIgnoreFailedSource> -->

src/Directory.Build.props

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,6 @@
22
<!-- See: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets -->
33
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), '$(MSBuildThisFileDirectory)../'))" />
44

5-
<PropertyGroup Label="Project output paths">
6-
<RelativeProjectPath>$([MSBuild]::MakeRelative($(SrcPath), $(MSBuildProjectDirectory)))</RelativeProjectPath>
7-
8-
<!-- Latest MSBuild tools uses the $(BaseOutputPath) and $(OutputPath) properties. Legacy properties are set based on them in Microsoft.Common.targets.
9-
By default, we configure the BaseOutputPath to the drop folder. Other adaptations to the final OutputPath can be done after this occurs.
10-
-->
11-
<BaseOutputPath>$([MSBuild]::NormalizeDirectory($(RepoBinRoot), $(RelativeProjectPath)))</BaseOutputPath>
12-
<!--
13-
Since we won't know the target framework folder (if applicable) when this file gets evaluated, we can't set
14-
the OutputPath correctly here. In general, this should be done in a Directory.Build.targets if needed.
15-
But it's preferable to only change the BaseOutputPath and let the OutputPath be computed by standard MSBuild props/targets.
16-
<OutputPath>$(BaseOutputPath)\$(TargetFramework)\</OutputPath> -->
17-
18-
<!-- WARNING: DO NOT use Configuration to change the base Intermediate path, as it circumvents common .net SDK build assets which do not depend on it. -->
19-
<BaseIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(RepoIntermediateRoot), $(RelativeProjectPath)))</BaseIntermediateOutputPath>
20-
</PropertyGroup>
21-
225
<PropertyGroup Label="Nuget defaults">
236
<!-- These settings allow projects to only need to include the properties unique to that project -->
247
<Authors>Microsoft</Authors>

0 commit comments

Comments
 (0)