Using Directory.Build.props with .NET Core 2

Mar 15, 2018  

The build system automatically includes the first Directory.Build.props file it finds in one of the project’s parent folders, which makes it fairly easy to maintain various assembly attributes globally, at the solution level.

See Customize your build in Microsoft documentation.

Example of a Directory.Build.props file

Here is an example of such a file:

    <Product>SwissInvoice Server</Product>
    <Copyright>Copyright © 2017-2018, EPSITEC SA, CH-1400 Yverdon-les-Bains, Switzerland</Copyright>

See this StackOverflow answer for a list of supported properties.

Generated Assembly

Opening one of the assemblies built with this Directory.Build.props settings with a tool like Reflector confirms that the build process produced the expected assembly level attributes:

assembly: attributes in Reflector

Explorer File Properties

The Details tab of the file properties now contains the expected properties:

Explorer File Properties