首页 新闻 会员 周边 捐助

.net core 神经病怎么治:dotnet publish 时复制 web.config 的奇怪问题

0
悬赏园豆:100 [已解决问题] 解决于 2019-06-25 13:57

asp.net core 项目中并没有 web.config ,但每次 dotnet publish 时 .net core cli 都神经病似地复制加了一堆 publish 的奇怪路径下的 web.config 文件,请问如何治疗 .net core 的这个神经病?

/usr/share/dotnet/sdk/3.0.100-preview6-012264/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(149,5): warning MSB3026: Could not copy "/src/Cnblogs.Web/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/web.config" to "/src/Cnblogs.Web/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/web.config". Beginning retry 1 in 1000ms. The process cannot access the file '/src/Cnblogs.Web/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/publish/web.config' because it is being used by another process. 
dudu的主页 dudu | 高人七级 | 园豆:30902
提问于:2019-06-25 11:53
< >
分享
最佳答案
0

通过一个偏方治好了,在 .csproj 中添加下面的配置 —— 发布时始终排除 web.config 文件

<ItemGroup>
  <Content Update="web.config" CopyToPublishDirectory="Never" />
</ItemGroup>
dudu | 高人七级 |园豆:30902 | 2019-06-25 13:57

今天通过 Publishing Dotnet Core creates multiples nested directories 这篇博文才知道了问题的真正原因 —— 问题是 publish 目标文件夹不在 bin 文件夹中触发的(我们使用的发布命令是 dotnet publish -c Release -o ./publish ),这样每次发布时都把上次发布的 publish 目标文件夹作为项目的一部分一起发布。

最简单的解决方法就是将 publish 目标文件夹放在 bin 文件夹中。

dudu | 园豆:30902 (高人七级) | 2019-06-26 16:55
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册