3rd party XML documentation files in NuGet packages are not copied to my project's build folder
See original GitHub issueI’ve dug around for a solution to this problem, but I only find issues related to dotnet publish
not including a project’s xml documentation. My issue is that XML documentation files in NuGet packages are not copied to my project’s build folder. I hope the distinction is clear to a human (google couldn’t get it).
Steps to reproduce
Add some_other_library nuget package which includes xml documentation to you project. Do dotnet build
Expected behavior
The some_other_library.xml is included in the build (output) folder like so: (screenshot from output of VS 2017)
Actual behavior
some_other_library.xml file is not present in the build (output) folder: (screenshot of output of dotnet cli)
Environment data
dotnet --info
output:
.NET Command Line Tools (2.1.101)
Product Information:
Version: 2.1.101
Commit SHA-1 hash: 6c22303bf0
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.101\
Microsoft .NET Core Shared Framework Host
Version : 2.0.6
Build : 74b1c703813c8910df5b96f304b0f2b78cdf194d
Issue Analytics
- State:
- Created 5 years ago
- Reactions:16
- Comments:27 (2 by maintainers)
Top Results From Across the Web
XML documentation is in package but never copied to ...
Iam stuck in the same problem. I have my nuget package included in my project. My package contains the assembly and the .xml...
Read more >Add NuGet package XML documentation to Swagger
Add API XML documentation from NuGet package to your Swagger definition! Copy XML docs from the nuget package to your build output.
Read more >Create a package using the nuget.exe CLI
A detailed guide on designing and creating a NuGet package, including files and versioning.
Read more >Building a NuGet Packages Architecture Part 6
Building a NuGet Packages Architecture Part 6/6: shows how to enhance your packages and the development experience.
Read more >Managing Dependencies in .NET: .csproj, .packages.config ...
nuget.config is an XML file containing settings that control the behavior of NuGet. This file is not directly involved in dependency management ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JoFrMueller you can do this to copy the xml and/or pdb files to the build output if it exists:
Also see my blog about this https://the-photographing-programmer.com/packagereferences-and-xml-documentation/
Granted it would be nice if there was build in support for this common use case but this seems to work pretty well and takes into account transitive dependencies as well and doesn’t lock your project into a specific targetframework.
We use this in our new project template for our game engine https://github.com/Barsonax/DualityProjectTemplate/blob/master/Source/Duality/Directory.Build.props#L12
This limitation is really painfull when the xml documentation are the one describing the model packed with NuGET and used on the WebAPI contracts where something like swagger is used to self document the WebApi themselves, in such a case there’s no possibility to auto-describe the contracts (since it is autodiscovered using the xml documentations)