See GitHub Issue #795 for the details and discussion.
One of the undocumented changes of converting from project.json to csproj, was the
<DocumentationFile> no longer automatically copied to the output folder during the build or publish process.
There have been multiple solutions, both
post publish scripts. However, understanding how MSBUILD works and finding the simplest way is key. Thanks to Eric Erhardt's latest comment here I think that this is the cleanest way.
Add the following snippet to the .csproj to enable the copy of the documentation file to the output folder.
It supports the F5 options as well as the
dotnet build /
dotnet publish CLI commands.
Another important option tested was the ability to pass a custom output folder using the
dotnet publish -c Release -o myreleasefolder
You can also add additional output locations to the
An example project is available on GitHub at https://github.com/spboyer/copydocfile-example for reference.