Search code examples
msbuildnugetnuget-packagecsprojpackagereference

How to include XML Documentation from Nuget Package in csproj build output


I have a nuget package that includes an XML documentation file.

packages/MyPackage.1.0.0/lib/net472/MyPackage.xml

However when I build my project, I want to include this xml file in the output.

So when I:

dotnet MyProj.csproj -c Release

I want to get:

> ls bin/Release/net472
MyProj.dll
MyPackage.dll
MyPackage.xml

However it never comes along. How can I get it?


Solution

  • I find one solution: Please find it at https://snede.net/add-nuget-package-xml-documentation-to-swagger/?unapproved=168&moderation-hash=14dbe7e7ca3d8affb6ace2bfdb7ff581

    This is actually a problem to copy files from nuget package to out dir or publish dir.

    Just modify csproj file to copy file from package's path after run build or publish.