2015-12-14 7 views
5

Mam projekt API ASP.NET WEB z plikiem Web.conig. Podczas budowania w VS2015 nie są zgłaszane żadne błędy ani ostrzeżenia. Jednak kiedy budować ten projekt na TeamCity przy użyciu MSBuild zbudować krok, otrzymuję ostrzeżenie MSB3247:Krok MSBuild w TeamCity dotyczy app.config zamiast web.config dla projektu ASP.NET WEB API skutkującego ostrzeżeniem 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> 

Wygląda pliku app.config jest uważany przez MSBuild zamiast Web.config, ponieważ proponuje dodanie bindingRedirtect, który są już obecne w moim pliku Web.config. Sprawdziłem to dwukrotnie, wklejając plik Web.config i zmieniając jego nazwę na App.config. To usunęło ostrzeżenie. Po usunięciu App.config - ostrzeżenie pojawia się ponownie. Więc moje pytania są 1) dlaczego chociaż MSBuild wydaje się używać app.config nie zawiedzie, gdy mam tylko Web.config w projekcie; 2) Jak mogę dać wskazówkę do MSBuild, aby użyć Web.config do powiązania przekierowania? 3) dlaczego budowanie dokładnie tego samego projektu w VS nie powoduje ostrzeżenia?

Odpowiedz

6

Problem polega na tym, że narzędzia Microsoft Web Developer Tools nie są zainstalowane. MSBuild nie wie, jak poprawnie obsługiwać pliki web.config w takim przypadku.

Możliwe rozwiązania:

  1. Install Microsoft ASP.NET i Web Tools 2015 na serwerze TeamCity

  2. skopiować te foldery do serwera TeamCity

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

    Upewnij się, że <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> w web csproj jest poprawne.

Plik Microsoft.WebApplication.targets odwołuje się do plików w folderze internetowym, dlatego też musi być na miejscu.

Roztwór zebrano z here.

Powiązane problemy