Skip to content

Instantly share code, notes, and snippets.

@egil
Created September 5, 2023 13:45
Show Gist options
  • Save egil/f14d1f7b4fdc73597ed44ea3e038cb8d to your computer and use it in GitHub Desktop.
Save egil/f14d1f7b4fdc73597ed44ea3e038cb8d to your computer and use it in GitHub Desktop.
Want to embed a changelog file's content inside the <PackageReleaseNotes> in your libraries, so it is readily visible on NuGET, you can do the following:
<!--
Automatically copy the content of a CHANGELOG.md file into a NuGET package's change log section via the `<PackageReleaseNotes>` element in .csproj by doing the following:
Put the following into your .csproj, e.g. `Lib.csproj`, and the content of your CHANGELOG.md will be embedded when the project is packaged.
This assumes that the project structure is as follows:
\CHANGELOG.md
\src\Lib\Lib.csproj
-->
<Target Name="SetPackageReleaseNotes" BeforeTargets="GenerateNuspec">
<PropertyGroup>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/../../CHANGELOG.md"))</PackageReleaseNotes>
</PropertyGroup>
</Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment