使用WebDeploy发布程序后文档xml文件丢失,导致swagger无法正确打开
国外也有这方面的讨论但是最终都没有有效的解决方案
或者 方案不是针对.NET 4.5的
研究了一下等到一个比较靠谱的方案
修改发布文件 *.pubxml
增加下面2段配置,问题解决,现在可以顺利将xml文件发布到服务器了
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
...
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="bin\**\*.xml" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>%(RecursiveDir)bin\%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<PropertyGroup>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForMsdeployDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
</Project>
网友评论