[英]How can I publish XML documentation with a .net core web application?
In the csproj file I've enabled XML documentation generation via the following tag: 在csproj文件中,我通过以下标记启用了XML文档生成:
<PropertyGroup>
<DocumentationFile>bin\xml\Project.Api.xml</DocumentationFile>
<NoWarn>1701;1702;1705;1591;1573</NoWarn>
</PropertyGroup>
This works and correctly builds xml docs. 这适用于并正确构建xml文档。 Now I need this XML file to be distributed with the application (for Swagger support among other things). 现在我需要将这个XML文件与应用程序一起分发(对于Swagger支持等)。 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. 但是,当我发布到文件夹(或azure)时,XML文档无处可寻。
What am I missing? 我错过了什么?
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. 他们使用更复杂的方式,但只是更多一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.