J'utilise le modèle ASP.NET Core + Angular 2 pour Visual Studio . J'ai mis à jour mon fichier project.json et il se présente maintenant (en partie):
"dependencies": {
"Microsoft.AspNetCore.AngularServices": "1.0.0-*",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0-preview1-final",
"Microsoft.AspNetCore.Diagnostics": "1.1.0-preview1-final",
"Microsoft.AspNetCore.Hosting.Abstractions": "1.1.0-preview1-final",
"Microsoft.AspNetCore.Identity": "1.1.0-preview1-final",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0-preview1-final",
"Microsoft.AspNetCore.Mvc": "1.1.0-preview1-final",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview3-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-preview1-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0-preview1-final",
"Microsoft.AspNetCore.StaticFiles": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.Design": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.Relational": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.Relational.Design": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.Sqlite": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview3-final",
"type": "build"
},
"Microsoft.EntityFrameworkCore.Tools.Core": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.CommandLine": "1.1.0-preview1-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0-preview1-final",
"Microsoft.Extensions.Configuration.Json": "1.1.0-preview1-final",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.1.0-preview1-final",
"Microsoft.Extensions.FileProviders.Abstractions": "1.1.0-preview1-final",
"Microsoft.Extensions.Logging": "1.1.0-preview1-final",
"Microsoft.Extensions.Logging.Abstractions": "1.1.0-preview1-final",
"Microsoft.Extensions.Logging.Console": "1.1.0-preview1-final",
"Microsoft.Extensions.Logging.Debug": "1.1.0-preview1-final",
"Microsoft.Extensions.Options": "1.1.0-preview1-final",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0-preview1-final",
"Microsoft.Extensions.Primitives": "1.1.0-preview1-final"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final"
},
"frameworks": {
"net461": {}
},
et quand je lance une application, j'ai une erreur:
System.IO.FileLoadException was unhandled
Message: An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module.
Additional information: Could not load file or Assembly 'Microsoft.AspNetCore.Hosting.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located Assembly's manifest definition does not match the Assembly reference. (Exception from HRESULT: 0x80131040)
Avez-vous une idée de ce qui ne va pas?
Essayez de supprimer le dossier bin
et de reconstruire la solution.
Regardez attentivement le message d'erreur. Je viens d'installer le package NuGet Microsoft.AspNetCore.Html.Abstractions sur le projet spécifique et de reconstruire la solution. Cela a résolu le problème pour moi!
Pour moi, ce problème ne s’est produit que après la publication de ma publication sur Azure.
Le correctif consistait à mettre à jour un nouveau paramètre dans Publish
-> Configure
-> Settings
et à définir le Deployment Mode
sur Self-Contained
.
En plus de la suppression des dossiers bin, je devais redémarrer ma machine pour éliminer cette erreur