Skip to content

Commit 479d013

Browse files
MSDN-WhiteKnightViktorHofer
andauthoredDec 12, 2022
Split library and package Readme (#78888)
* Split library and package Readme * Fix punctuation * Fix lint issues * Automatically include package readme file if existent * Rename README.md to PACKAGE.md * Move PACKAGE.md into source directory * Reinstate examples in README.md * Update contributing guidelines * Update docs/coding-guidelines/libraries-packaging.md Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
1 parent b5da2c6 commit 479d013

File tree

44 files changed

+424
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+424
-81
lines changed
 

‎docs/coding-guidelines/libraries-packaging.md

+18-11
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,29 @@ Libraries to be packaged must set `IsPackable` to true. By default, all `librari
4040

4141
Package versions and shipping state should be controlled using the properties defined by the [Arcade SDK](https://github.com/dotnet/arcade/blob/master/Documentation/ArcadeSdk.md#project-properties-defined-by-the-sdk). Typically libraries should not need to explicitly set any of these properties.
4242

43-
Most metadata for packages is controlled centrally in the repository and individual projects may not need to make any changes to these. One property is required to be set in each project: `PackageDescription`. This should be set to a descriptive summary of the purpose of the package, and a list of common entry-point types for the package: to aide in search engine optimization. Example:
43+
Most metadata for packages is controlled centrally in the repository and individual projects may not need to make any changes to these. One property is required to be set in each project: `PackageDescription`. This should be set to a descriptive summary of the purpose of the package. Example:
44+
4445
```xml
45-
<PackageDescription>Logging abstractions for Microsoft.Extensions.Logging.
46-
47-
Commonly Used Types:
48-
Microsoft.Extensions.Logging.ILogger
49-
Microsoft.Extensions.Logging.ILoggerFactory
50-
Microsoft.Extensions.Logging.ILogger&lt;TCategoryName&gt;
51-
Microsoft.Extensions.Logging.LogLevel
52-
Microsoft.Extensions.Logging.Logger&lt;T&gt;
53-
Microsoft.Extensions.Logging.LoggerMessage
54-
Microsoft.Extensions.Logging.Abstractions.NullLogger</PackageDescription>
46+
<PackageDescription>Logging abstractions for Microsoft.Extensions.Logging.</PackageDescription>
5547
```
5648

5749
Package content can be defined using any of the publicly defined Pack inputs: https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets
5850

51+
### Package Readme
52+
53+
Packages can include a Markdown Readme file with a short usage documentation. To include a package Readme, create a `PACKAGE.md` file in the library `src` directory. The file will be automatically included in the package and used as a Readme if its name matches this convention.
54+
55+
The package Readme is displayed on the package details page on [NuGet gallery](https://nuget.org/). You can include the following content in it:
56+
57+
- A description of the package purpose.
58+
- Information when package should be used. For example, if the library is included in the shared framework in .NET, but needs to be installed via NuGet on .NET Framework, it should be mentioned.
59+
- Information on how to get started with the package.
60+
- Links to related documentation.
61+
- A list of common entry-point types for the package, with links to their API docs under [.NET API Browser](https://learn.microsoft.com/dotnet/api/).
62+
- A short code example that demostrates the package usage.
63+
64+
For a list of supported Markdown features, see [NuGet documentation](https://learn.microsoft.com/nuget/nuget-org/package-readme-on-nuget-org#supported-markdown-features).
65+
5966
### Build props / targets and other content
6067

6168
Build props and targets may be needed in NuGet packages. To define these, author a build folder in your src project and place the necessary props/targets in this subfolder. You can then add items to include these in the package by defining `Content` items and setting `PackagePath` as follows:

‎eng/packaging.targets

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<!-- Don't include target platform specific dependencies, since we use the target platform to represent RIDs instead -->
1212
<SuppressDependenciesWhenPacking Condition="'$(TargetPlatformIdentifier)' != ''">true</SuppressDependenciesWhenPacking>
1313
<PackageDesignerMarkerFile>$(MSBuildThisFileDirectory)useSharedDesignerContext.txt</PackageDesignerMarkerFile>
14+
<PackageReadmeFile Condition="'$(PackageReadmeFile)' == '' and Exists('PACKAGE.md')">PACKAGE.md</PackageReadmeFile>
1415
<!-- Generate packages for rid specific projects or for allconfigurations during build. -->
1516
<!-- A package isn't generated if in servicing or in runtimelab. Intended to be overridden at project level. -->
1617
<IsRIDSpecificProject Condition="$(MSBuildProjectName.StartsWith('runtime.')) and
@@ -57,6 +58,11 @@
5758
TargetFramework="$(NetFrameworkMinimum)" />
5859
</ItemGroup>
5960

61+
<!-- Add a package README file from. -->
62+
<ItemGroup Condition="'$(PackageReadmeFile)' != ''">
63+
<None Include="$(PackageReadmeFile)" Pack="true" PackagePath="\" />
64+
</ItemGroup>
65+
6066
<Choose>
6167
<When Condition="'$(AddXamarinPlaceholderFilesToPackage)' == 'true' or '$(AddNETFrameworkPlaceholderFileToPackage)' == 'true'">
6268
<PropertyGroup>

0 commit comments

Comments
 (0)
Please sign in to comment.