I've made a nuget package containing a generated xml
documentation file and published this package on a private repository.
Here is the .csproj
of the nuget package.
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<DocumentationFile>$(MSBuildProjectDirectory)\Test.xml</DocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Test.xml">
<IncludeInPackage>true</IncludeInPackage>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
When I restore this packages on other machines using dotnet restore Another.Project.csproj
, the package is restored correctly but the xml
documentation file is missing.
I can see that the file lib/netcoreapp2.2/Test.xml
exists inside %userprofile%\.nuget\packages\test\1.x.x\Test.1.x.x.nupkg
.
But for some reasons it's not extracted to the %userprofile%\.nuget\packages\test\1.x.x\lib\netcoreapp2.2\
directory.
How can I make sure the xml
resource file get extracted when I restore the package?
Notes
I need to do this since I'm following this blog post to use the
xml
file in swagger https://snede.net/add-nuget-package-xml-documentation-to-swagger/I'd like to avoid setting the
xml
file build action toContent
if possible.The
dll
files are extracted correctly. The package is working as intended.