TeamCity中的MSBuild步骤考虑将ASP.NET WEB API项目的app.config而不是web.config视为警告MSB3247 [英] MSBuild step in TeamCity considers app.config instead of web.config for ASP.NET WEB API project resulting in warning MSB3247

查看:66
本文介绍了TeamCity中的MSBuild步骤考虑将ASP.NET WEB API项目的app.config而不是web.config视为警告MSB3247的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have ASP.NET WEB API project with Web.conig file. When it builds in VS2015, no errors and no warnings are reported. However when I build this project on TeamCity using MSBuild build step, I get warning 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:\TeamCity\buildAgent\work\2772494ce0e0bbd7\branches\Stategic.Window.Release1\src\Strategic.Window\packages\protobuf-net.2.0.0.668\lib\net40\protobuf-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:\TeamCity\buildAgent\work\2772494ce0e0bbd7\branches\Stategic.Window.Release1\src\Strategic.Window\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.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:\TeamCity\buildAgent\work\2772494ce0e0bbd7\branches\Stategic.Window.Release1\src\Strategic.Window\packages\RazorEngine.3.7.4\lib\net45\RazorEngine.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:\TeamCity\buildAgent\work\2772494ce0e0bbd7\branches\Stategic.Window.Release1\src\Strategic.Window\packages\WebGrease.1.5.2\lib\WebGrease.dll] to solve conflict and get rid of warning.
[14:30:01]W: [ResolveAssemblyReference] C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.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: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="protobuf-net" culture="neutral" publicKeyToken="257b51d87d2e4d67" /><bindingRedirect oldVersion="0.0.0.0-2.0.0.668" newVersion="2.0.0.668" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="RazorEngine" culture="neutral" publicKeyToken="9ee697374c7e744a" /><bindingRedirect oldVersion="0.0.0.0-3.7.4.0" newVersion="3.7.4.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /></dependentAssembly></assemblyBinding>

MSBuild正在考虑使用app.config文件而不是Web.config,因为它提议添加bindingRedirtect,而我的Web.config文件中已经存在该文件.我通过复制粘贴Web.config并将其重命名为App.config进行了仔细检查.这消除了警告.删除App.config后-再次出现警告.所以我的问题是:1)为什么当我的项目中只有Web.config时,尽管MSBuild似乎正在使用app.config; 2)我如何提示MSBuild使用Web.config进行绑定重定向? 3)为什么在VS中建立完全相同的项目不会产生警告?

Looks like app.config file is being considered by MSBuild instead of Web.config, because it proposes to add bindingRedirtect, which are already present in my Web.config file. I double-checked this by copy-pasting Web.config and renaming it to App.config. This removed the warning. When App.config is deleted - warning reappears. So my questions are 1) why although MSBuild seems to be using app.config does not fail when I have only Web.config in the project; 2) How can I give a hint to MSBuild to use Web.config for binding redirect? 3) why building exactly the same project in VS does not yield a warning?

推荐答案

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

The issue is that Microsoft Web Developer Tools is not installed. MSBuild does not know how to handle the web.config files properly in such a case.

可能的解决方案:

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

  1. Install Microsoft ASP.NET and Web Tools 2015 on the TeamCity server

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

Copy those folders to the TeamCity server

  • c:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ WebApplications \
  • c:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ Web \

确保网络csproj中的<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />是正确的.

make sure that <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> in the web csproj is correct.

文件Microsoft.WebApplication.targets引用了Web文件夹中的文件,因此,它也必须在适当的位置.

The file Microsoft.WebApplication.targets references files in the Web folder, therefore, it must be in place as well.

解决方案是从此处收集的.

这篇关于TeamCity中的MSBuild步骤考虑将ASP.NET WEB API项目的app.config而不是web.config视为警告MSB3247的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆