![](/img/trans.png)
[英]How can I publish an ASP.Net Core Web Api to HTTP instead of HTTPS in development?
[英]How can I publish XML documentation with a .net core web application?
在csproj文件中,我通過以下標記啟用了XML文檔生成:
<PropertyGroup>
<DocumentationFile>bin\xml\Project.Api.xml</DocumentationFile>
<NoWarn>1701;1702;1705;1591;1573</NoWarn>
</PropertyGroup>
這適用於並正確構建xml文檔。 現在我需要將這個XML文件與應用程序一起分發(對於Swagger支持等)。 所以我添加了以下內容:
<ItemGroup>
<None Update="bin\xml\Project.Api.xml">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
但是,當我發布到文件夾(或azure)時,XML文檔無處可尋。
我錯過了什么?
以下適用於您的場景(至少在發布到文件夾時):
<!-- 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>
在這里,您可以找到有關如何將自定義文件包含到發布輸出中的文檔。 他們使用更復雜的方式,但只是更多一點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.