2013-06-26 5 views
21

Hinweis: Diese Frage wurde einige Tage nach der ursprünglichen Veröffentlichung vollständig neu geschrieben.Probleme mit Microsoft HTTP-Clientbibliotheken v2.1.10 NuGet-Update

Ich habe eine ASP.NET MVC-App, die in VS 2012 entwickelt und in Azure implementiert wurde. Die ursprünglichen Projekte wurden aus der ASP.NET MVC 4-Projektvorlage erstellt.

NuGet hat vor kurzem angefangen, eine ganze Reihe von aktualisierten Paketen von Microsoft zu zeigen. Eines dieser Updates, Microsoft HTTP-Clientbibliotheken v2.1.10, verursacht schwerwiegende Probleme bei der Installation.

  1. Es installiert MicrosoftBcl.Build, die mit meinem Azure Projekt nicht kompatibel ist (siehe this SO question für das Problem und seine Lösung).

  2. Es verursacht eine ganze Reihe von "inkompatiblen DLL" -Problemen (siehe unten).

Dies wirft mehrere brennende Fragen:

  1. Meine MVC-app nur eine Website ist. Es läuft nur in einem Webbrowser. Brauche ich dieses Paket überhaupt? (ZB wird es durch Vorlagencode verwendet, der möglicherweise subtil bricht, wenn ich das Paket entferne?)

  2. Gemäß der Projektseite (http://blogs.msdn.com/b/bclteam/p/httpclient.aspx) gibt es ein paar neuere (wenn auch Beta) Versionen von dieses Produkt. Ich nehme an, ich würde sie sehen, wenn ich NuGet sagen würde, dass er mir nicht veröffentlichte Versionen zeigen soll. Behebt diese Version die oben beschriebenen Probleme?

Hier sind die Warnungen ich bekomme, wenn ich die Lösung nach der Installation des aktualisierten NuGet Paket bauen ...

1>------ Build started: Project: Ruby, Configuration: Release Any CPU ------ 
1> All packages listed in packages.config are already installed. 
1> No way to resolve conflict between "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Choosing "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" arbitrarily. 
1> Consider app.config remapping of assembly "DotNetOpenAuth.AspNet, Culture=neutral, PublicKeyToken=2780ccd10d57b246" from Version "4.0.0.0" [] to Version "4.3.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\DotNetOpenAuth.AspNet.4.3.0.13117\lib\net45-full\DotNetOpenAuth.AspNet.dll] to solve conflict and get rid of warning. 
1> Consider app.config remapping of assembly "System.Web.Mvc, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "3.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll] to Version "4.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll] to solve conflict and get rid of warning. 
1> Consider app.config remapping of assembly "System.Web.Razor, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll] to Version "2.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll] to solve conflict and get rid of warning. 
1> Consider app.config remapping of assembly "WebGrease, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [] to Version "1.3.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\WebGrease.1.3.0\lib\WebGrease.dll] to solve conflict and get rid of warning. 
1> Consider app.config remapping of assembly "System.Web.WebPages.Razor, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.Razor.dll] to Version "2.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll] to solve conflict and get rid of warning. 
1> Consider app.config remapping of assembly "Microsoft.Data.OData, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.5.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.Data.OData.5.5.0\lib\net40\Microsoft.Data.OData.dll] to solve conflict and get rid of warning. 
1> Consider app.config remapping of assembly "System.Web.WebPages, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll] to Version "2.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll] to solve conflict and get rid of warning. 
1> Consider app.config remapping of assembly "DotNetOpenAuth.Core, Culture=neutral, PublicKeyToken=2780ccd10d57b246" from Version "4.0.0.0" [] to Version "4.3.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\DotNetOpenAuth.Core.4.3.0.13117\lib\net45-full\DotNetOpenAuth.Core.dll] to solve conflict and get rid of warning. 
1> Consider app.config remapping of assembly "System.Web.WebPages.Deployment, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.Deployment.dll] to Version "2.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll] to solve conflict and get rid of warning. 
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. 
1> Ruby -> C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\Ruby\bin\Ruby.dll 
2>------ Build started: Project: Ruby.Azure, Configuration: Release Any CPU ------ 
3>------ Publish started: Project: Ruby.Azure, Configuration: Release Any CPU ------ 
3>C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets(220,5): warning : All projects referencing Ruby.csproj must install nuget package Microsoft.Bcl.Build. 
3>  No way to resolve conflict between "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Choosing "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" arbitrarily. 
3>  Consider app.config remapping of assembly "DotNetOpenAuth.AspNet, Culture=neutral, PublicKeyToken=2780ccd10d57b246" from Version "4.0.0.0" [] to Version "4.3.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\DotNetOpenAuth.AspNet.4.3.0.13117\lib\net45-full\DotNetOpenAuth.AspNet.dll] to solve conflict and get rid of warning. 
3>  Consider app.config remapping of assembly "System.Web.Mvc, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "3.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll] to Version "4.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll] to solve conflict and get rid of warning. 
3>  Consider app.config remapping of assembly "System.Web.Razor, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll] to Version "2.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll] to solve conflict and get rid of warning. 
3>  Consider app.config remapping of assembly "WebGrease, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [] to Version "1.3.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\WebGrease.1.3.0\lib\WebGrease.dll] to solve conflict and get rid of warning. 
3>  Consider app.config remapping of assembly "System.Web.WebPages.Razor, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.Razor.dll] to Version "2.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll] to solve conflict and get rid of warning. 
3>  Consider app.config remapping of assembly "Microsoft.Data.OData, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.5.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.Data.OData.5.5.0\lib\net40\Microsoft.Data.OData.dll] to solve conflict and get rid of warning. 
3>  Consider app.config remapping of assembly "System.Web.WebPages, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll] to Version "2.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll] to solve conflict and get rid of warning. 
3>  Consider app.config remapping of assembly "DotNetOpenAuth.Core, Culture=neutral, PublicKeyToken=2780ccd10d57b246" from Version "4.0.0.0" [] to Version "4.3.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\DotNetOpenAuth.Core.4.3.0.13117\lib\net45-full\DotNetOpenAuth.Core.dll] to solve conflict and get rid of warning. 
3>  Consider app.config remapping of assembly "System.Web.WebPages.Deployment, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.Deployment.dll] to Version "2.0.0.0" [C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll] to solve conflict and get rid of warning. 
3>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. 
3>  Transformed Web.config using C:\Users\Robert\Documents\SBSoftware\SCM\Ruby\Ruby\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config. 
3>Ruby(0,0): warning WAT153: The web project 'Ruby' is dependent on the following MVC assembly: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll. MVC assemblies must be added to the package or installed on the virtual machine for your web role. For more details about this, see the following help page: http://go.microsoft.com/fwlink/?LinkId=218227. 
3>Ruby(0,0): warning WAT153: The web project 'Ruby' is dependent on the following MVC assembly: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll. MVC assemblies must be added to the package or installed on the virtual machine for your web role. For more details about this, see the following help page: http://go.microsoft.com/fwlink/?LinkId=218227. 
3>Ruby(0,0): warning WAT153: The web project 'Ruby' is dependent on the following MVC assembly: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.Razor.dll. MVC assemblies must be added to the package or installed on the virtual machine for your web role. For more details about this, see the following help page: http://go.microsoft.com/fwlink/?LinkId=218227. 
3>Ruby(0,0): warning WAT153: The web project 'Ruby' is dependent on the following MVC assembly: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll. MVC assemblies must be added to the package or installed on the virtual machine for your web role. For more details about this, see the following help page: http://go.microsoft.com/fwlink/?LinkId=218227. 
3>Ruby(0,0): warning WAT153: The web project 'Ruby' is dependent on the following MVC assembly: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.Deployment.dll. MVC assemblies must be added to the package or installed on the virtual machine for your web role. For more details about this, see the following help page: http://go.microsoft.com/fwlink/?LinkId=218227. 
+0

Haben Sie lesen [veröffentlichen MVC-Projekt als Web-Rolle in Windows Azure] (http://msdn.microsoft.com/en-us/library/hh369932.aspx#PublishMVC)? –

+2

In der Entwicklungsumgebung (in keiner Weise mit Azure verwandt) werden beim Hinzufügen von Nuget-Paketen, die 'Microsoft.Bcl.Build' erfordern, dieselben Warnungen ausgegeben. – mostruash

+3

Ich habe das gleiche Problem in einer MVC 4 App - außer, dass ich NICHT in Azure veröffentlichen ... nur einen normalen alten Windows 2008 R2 Web Server. – theBoringCoder

Antwort

8

Sie binding redirects in Ihrer web.config-Datei Probleme lösen können.

Zum Beispiel für Zeile:

Consider app.config remapping of assembly "DotNetOpenAuth.AspNet, Culture=neutral, PublicKeyToken=2780ccd10d57b246" from Version "4.0.0.0" [] to Version "4.3.0.0" 

in Web.config hinzufügen:

<configuration> 
    <runtime> 
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
      <assemblyIdentity name="DotNetOpenAuth.AspNet" 
           publicKeyToken="2780ccd10d57b246" 
           culture="neutral" /> 
      <bindingRedirect oldVersion="1.0.0.0-4.3.0.0" 
          newVersion="4.3.0.0"/> 
     </dependentAssembly> 
     </assemblyBinding> 
    </runtime> 
</configuration> 

und so weiter ... Für jede DLL, die Ausnahme hinzufügen, um zusätzliche dependentAssembly Knoten erstellt.

+4

Ich habe das gleiche Problem wie das Original-Poster hier (ausgenommen, dass ich meine App nicht zu Azure veröffentliche) und sofort verbindliche Redirects hinzugefügt. Es behebt das Problem nicht. Es sollte ... aber es tut es nicht. – theBoringCoder

+0

Ich hatte das gleiche Problem, versuchte auch bindende Weiterleitungen ohne Glück. Sie müssen explizit 'dependentAssembly' wie oben gezeigt verwenden und nicht nur 'bindingRedirect'. – TheCodeKing

4

Eine Situation, die diesen Fehler verursacht, ist das Ausführen des Azure-Pakets oder das Veröffentlichen von Befehlen, ohne zuvor eine saubere Neuerstellung für die gleiche Konfiguration (z. B. Release) vorgenommen zu haben.

Dieses regelte es für mich:

  1. die WindowsAzure.Storage NuGet Paket neu installieren, indem Sie den folgenden Befehl auf dem NuGet Package Manager-Konsole ausgeführt wird:

  2. Erstellen Sie das MVC Webanwendungsprojekts (Debuggen und Freigeben)

Wenn dies nicht hilft Ihnen die „MSBuild-Projekt Build-Ausgabe Ausführlichkeit“ unter TOOL einstellen könnten -> Optionen -> „Projekte und Lösungen“ -> „Build and Run“ mit „Diagnose“ und prüfen Sie, welche Ursachen der Assembly-Konflikt (z. B. nach "Projekt-Datei-Item enthält, was die Referenz verursacht hat").

+0

Diese Antwort hat mit NuGet Package Restore für mich funktioniert. Wechseln Sie zur Veröffentlichungskonfiguration (in meinem Fall Release), bereinigen Sie die Lösung, erstellen Sie die Lösung neu - im Falle einer Paketwiederherstellung möglicherweise zweimal. Dann funktioniert Publish to Azure. Vielen Dank! –

4

Sie benötigen eine app.config-Datei mit den Umleitungen zu aktualisieren/erstellen, wie hier erwähnt:

https://cpaterson.wordpress.com/2014/03/28/found-conflicts-between-different-versions-of-assembly-consider-app-config-remapping-of-assembly/

+0

Eine 'app.config' Datei zu erstellen und die Weiterleitungen von meiner' web.config' zu kopieren, löschte die dummen Warnungen für mich. Dennoch macht es keinen Sinn, warum ich eine 'app.config' Datei für ein MVC Projekt benötige. Naja, ich bin nur froh endlich diese lästigen Warnungen los zu sein! – Alexander