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 pre
and 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 --o|--output
parameter.
dotnet publish -c Release -o myreleasefolder
Other options
You can also add additional output locations to the <DocumentationFile>
node.
Resources
An example project is available on GitHub at https://github.com/spboyer/copydocfile-example for reference.