Reputation: 27803
In the csproj file I've enabled XML documentation generation via the following tag:
<PropertyGroup>
<DocumentationFile>bin\xml\Project.Api.xml</DocumentationFile>
<NoWarn>1701;1702;1705;1591;1573</NoWarn>
</PropertyGroup>
This works and correctly builds xml docs. Now I need this XML file to be distributed with the application (for Swagger support among other things). So I added the following:
<ItemGroup>
<None Update="bin\xml\Project.Api.xml">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
However, when I publish to a folder (or to azure) the XML doc is no where to be found.
What am I missing?
Upvotes: 5
Views: 2495
Reputation: 101453
The following works for me in your scenario (at least when publishing to folder):
<!-- Run before PrepareForPublish target -->
<Target Name="CopyDocumentationFile" BeforeTargets="PrepareForPublish">
<ItemGroup>
<DocFile Include="$(DocumentationFile)" />
</ItemGroup>
<!--just copy doc file to target location -->
<Copy SourceFiles="@(DocFile)" DestinationFolder="$(PublishDir)" SkipUnchangedFiles="true" />
</Target>
Here you can find docs about how to include custom files into publish output in general. They use more complicated way, but just a little bit more.
Upvotes: 3