Treasure.Build.CentralBuildOutput 0.1.0-beta.8

This is a prerelease version of Treasure.Build.CentralBuildOutput.
There is a newer version of this package available.
See the version list below for details.
<Sdk Name="Treasure.Build.CentralBuildOutput" Version="0.1.0-beta.8" />
For projects that support Sdk, copy this XML node into the project file to reference the package.

Treasure.Build.CentralBuildOutput

NuGet NuGet

The Treasure.Build.CentralBuildOutput MSBuild project SDK allows project tree owners to centralize their build output in one place. By default, build output is placed in the project folder in bin and obj folders. This SDK will cause all of the build output to be written to a common set of folders in a tree structure that mimics the project structure.

Centrally Managing Build Output

To get started, you will need to create a Directory.Build.props file at the root of your repository if you don't have one already. In that file, you'll need to declare a CentralBuildOutputPath property with the value set to the path of the location you want to write the build output. You'll then need to import the Treasure.Build.CentralBuildOutput SDK.

Example Directory.Build.props:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    
    <CentralBuildOutputPath>$(MSBuildThisFileDirectory)</CentralBuildOutputPath>
  </PropertyGroup>

  
  <Sdk Name="Treasure.Build.CentralBuildOutput" Version="1.0.0" />
</Project>

Note:

The version number can be declared other ways. See here.

Build output folders written to the location defined by the CentralBuildOutputPath MSBuild property:

Folder Name Description
__intermediate The intermediate build output.
__output The build output.
__packages The output of packages.
__publish The published output.
__test-results The output of test results including Coverlet reports.

You can change the default prefix (__) by setting a new value to the CentralBuildOutputFolderPrefix MSBuild property.

Underneath these build output folders will be a tree structure that matches the tree structure of your project folders.

Consider the following project structure:

/Directory.Build.props
/src/MyClassLibrary/MyClassLibrary.csproj
/src/MyClassLibrary.Tests/MyClassLibrary.Tests.csproj

The relative path between the root of your repository and your project will be calculated. For the structure above, the relative path for MyClassLibrary is src/MyClassLibrary. A Debug build, publish, package, and test output would look like the following:

/__intermediate/src/MyClassLibrary/*
/__intermediate/src/MyClassLibrary.Tests/*
/__output/Debug/AnyCPU/src/MyClassLibrary/net6.0/*
/__output/Debug/AnyCPU/src/MyClassLibrary.Tests/net6.0/*
/__packages/NuGet/Debug/*
/__publish/Debug/AnyCPU/src/MyClassLibrary/*
/__test-results/src/MyClassLibrary.Tests/*

The relative path can be adjusted using the CentralBuildOutputRelativeToPath MSBuild property. For example:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    
    <CentralBuildOutputPath>$(MSBuildThisFileDirectory)</CentralBuildOutputPath>

    
    <CentralBuildOutputRelativeToPath>$(MSBuildThisFileDirectory)/src</CentralBuildOutputRelativeToPath>
  </PropertyGroup>

  
  <Sdk Name="Treasure.Build.CentralBuildOutput" Version="1.0.0" />
</Project>

This would result in the following build output:

/__intermediate/MyClassLibrary/*
/__intermediate/MyClassLibrary.Tests/*
/__output/Debug/AnyCPU/MyClassLibrary/net6.0/*
/__output/Debug/AnyCPU/MyClassLibrary.Tests/net6.0/*
/__packages/NuGet/Debug/*
/__publish/Debug/AnyCPU/MyClassLibrary/*
/__test-results/MyClassLibrary.Tests/*

Extensibility

Setting the following properties controls how Central Build Output works.

Property Description
CentralBuildOutputPath (Required) Defines the output path of the build output folders.
CentralBuildOutputFolderPrefix Overrides the output folder prefix. Default is __.
CentralBuildOutputRelativeToPath Redefines the root folder used to calculate the relative folder used in build output folders.
CustomBeforeCentralBuildOutputProps A list of custom MSBuild projects to import before central build output properties are declared.
CustomAfterCentralBuildOutputProps A list of custom MSBuild projects to import after central build output properties are declared.
CustomBeforeCentralBuildOutputTargets A list of custom MSBuild projects to import before central build output targets are declared.
CustomAfterCentralBuildOutputTargets A list of custom MSBuild projects to import after central build output targets are declared.
EnableCentralBuildOutput Indicates whether central build output is enabled or not. Set to false to disable.
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.0 402 11/24/2023
3.0.0 2,483 4/19/2023
2.0.0 809 12/29/2022
1.0.17 574 11/24/2022
1.0.10 746 10/11/2022
1.0.9 427 10/8/2022
1.0.8 379 10/8/2022
1.0.7 404 10/8/2022
1.0.0 629 9/10/2022
0.1.1-beta.12 983 4/9/2022
0.1.1-beta.9 150 4/5/2022
0.1.1-beta.7 170 4/3/2022
0.1.1-beta.6 110 4/2/2022
0.1.1-beta.3 169 3/14/2022
0.1.1-beta.1 135 3/14/2022
0.1.0-beta.8 109 3/14/2022
0.1.0-beta.6 130 3/13/2022
0.1.0-beta.5 116 3/13/2022
0.1.0-beta.3 112 3/13/2022