Csharp/C#教程:TeamCity中的MSBuild步骤考虑了app.config而不是ASP.NET WEB API项目的web.config,导致警告MSB3247分享


TeamCity中的MSBuild步骤考虑了app.config而不是ASP.NET WEB API项目的web.config,导致警告MSB3247

我有带有Web.conig文件的ASP.NET WEB API项目。 在VS2015中构建时,不会报告错误和警告。 但是,当我使用MSBuild构建步骤在TeamCity上构建此项目时,我收到警告MSB3247:

[ResolveAssemblyReferences] ResolveAssemblyReference [14:30:01] : [ResolveAssemblyReference] No way to resolve conflict between "protobuf-net, Version=2.0.0.602, Culture=neutral, PublicKeyToken=257b51d87d2e4d67" and "protobuf-net, Version=2.0.0.480, Culture=neutral, PublicKeyToken=257b51d87d2e4d67". Choosing "protobuf-net, Version=2.0.0.602, Culture=neutral, PublicKeyToken=257b51d87d2e4d67" arbitrarily. [14:30:01] : [ResolveAssemblyReference] No way to resolve conflict between "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily. [14:30:01] : [ResolveAssemblyReference] Consider app.config remapping of assembly "protobuf-net, Culture=neutral, PublicKeyToken=257b51d87d2e4d67" from Version "2.0.0.602" [] to Version "2.0.0.668" [D:TeamCitybuildAgentwork2772494ce0e0bbd7branchesStategic.Window.Release1srcStrategic.Windowpackagesprotobuf-net.2.0.0.668libnet40protobuf-net.dll] to solve conflict and get rid of warning. [14:30:01] : [ResolveAssemblyReference] Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "6.0.0.0" [] to Version "7.0.0.0" [D:TeamCitybuildAgentwork2772494ce0e0bbd7branchesStategic.Window.Release1srcStrategic.WindowpackagesNewtonsoft.Json.7.0.1libnet45Newtonsoft.Json.dll] to solve conflict and get rid of warning. [14:30:01] : [ResolveAssemblyReference] Consider app.config remapping of assembly "RazorEngine, Culture=neutral, PublicKeyToken=9ee697374c7e744a" from Version "3.0.8.0" [] to Version "3.7.4.0" [D:TeamCitybuildAgentwork2772494ce0e0bbd7branchesStategic.Window.Release1srcStrategic.WindowpackagesRazorEngine.3.7.4libnet45RazorEngine.dll] to solve conflict and get rid of warning. [14:30:01] : [ResolveAssemblyReference] Consider app.config remapping of assembly "WebGrease, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.5.1.25624" [] to Version "1.5.2.14234" [D:TeamCitybuildAgentwork2772494ce0e0bbd7branchesStategic.Window.Release1srcStrategic.WindowpackagesWebGrease.1.5.2libWebGrease.dll] to solve conflict and get rid of warning. [14:30:01]W: [ResolveAssemblyReference] C:Program Files (x86)MSBuild14.0binMicrosoft.Common.CurrentVersion.targets(1819, 5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:  

看起来app.config文件正在被MSBuild而不是Web.config考虑,因为它建议添加bindingRedirtect,它们已存在于我的Web.config文件中。 我通过复制粘贴Web.config并将其重命名为App.config来仔细检查。 这删除了警告。 删除App.config时 – 会再次出现警告。 所以我的问题是1)为什么虽然MSBuild似乎使用app.config并没有失败,当我在项目中只有Web.config时; 2)如何给MSBuild提示使用Web.config进行绑定重定向? 3)为什么在VS中构建完全相同的项目不会产生警告?

问题是未安装Microsoft Web Developer Tools。 在这种情况下,MSBuild不知道如何正确处理web.config文件。

可能的解决方案:

  1. 在TeamCity服务器上安装Microsoft ASP.NET和Web Tools 2015

  2. 将这些文件夹复制到TeamCity服务器

    确保中的是正确的。

Microsoft.WebApplication.targets文件引用Web文件夹中的文件,因此它也必须就位。

从这里收获溶液。

上述就是C#学习教程:TeamCity中的MSBuild步骤考虑了app.config而不是ASP.NET WEB API项目的web.config,导致警告MSB3247分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/1001661.html

(0)
上一篇 2021年12月27日
下一篇 2021年12月27日

精彩推荐