J'ai essayé d'ajouter
<PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="2.2.0" />
Cependant, la version 2.2.0 est la dernière version disponible actuellement, ce qui ne correspond pas à l'erreur. L'erreur est toujours la même après la reconstruction de l'application.
project.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.0" />
</ItemGroup>
</Project>
Erreur complète:
Exception non-gérée. System.IO.FileNotFoundException: impossible de charger le fichier ou l'assembly 'Microsoft.AspNetCore.Razor.Runtime, Version = 3.1.1.0, Culture = neutral, PublicKeyToken = adb9793829ddae60'. Le système ne peut pas trouver le fichier spécifié.
Nom de fichier: 'Microsoft.AspNetCore.Razor.Runtime, Version = 3.1.1.0, Culture = neutre, PublicKeyToken = adb9793829ddae60' à System.ModuleHandle.ResolveTypeHandleInternal (module RuntimeModule, type Int32Token, RuntimeTypeHandle60 'à System.ModuleHandle.ResolveTypeHandleInternal (module RuntimeModule, type Int32Token, RuntimeTypeHandleType) System.Reflection.RuntimeModule.ResolveType (Int32 MetadataToken, type [] genericTypeArguments, type [] genericMethodArguments) à System.Reflection.CustomAttribute.FilterCustomAttributeRecord (MetadataToken caCtorToken, MetadataImport et portée, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder
1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder
1 et attributs , RuntimeModule decoredModule, Int32 decoredMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder1 derivedAttributes) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly Assembly, RuntimeType caType) at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit) at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit) at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit) at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](Assembly element) at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartFactory.GetApplicationPartFactory(Assembly Assembly) at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateDefaultParts(String entryAssemblyName) at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.GetApplicationPartManager(IServiceCollection services) at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection services) at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersCore(IServiceCollection services) at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViewsCore(IServiceCollection services) at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViews(IServiceCollection services) at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services) at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddRelatedParts(IdentityBuilder builder) at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddDefaultUI(IdentityBuilder builder) at Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionUIExtensions.AddDefaultIdentity[TUser](IServiceCollection services, Action
1 configureOptions) chez Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionUIExtensions.AddDefaultIdentity (IS) services) sur pieshop.Startup.ConfigureServices (services IServiceCollection) dans /home/juan/code/web-projects/pieshop/src/Startup.cs:line 36 sur System.RuntimeMethodHandle.InvokeMethod (Object target, Object [] arguments, Signature sig, Boolean constructeur, Boolean wrapExceptions) à System.Reflection.RuntimeMethodInfo.Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object [] parameters, CultureInfo culture)
sur Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore (instance d'objet, services IServiceCollection) sur Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder. <> c__DisplayClass9_0.g__Startupilder.InvokeCore (instance d'objet, services IServiceCollection) sur Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder. <> c__DisplayClass9_0.g__Startupilder. .Invoke (instance d'objet, services IServiceCollection) chez Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder. <> C__DisplayClass8_0.b__0 (services IServiceCollection) chez Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartBuilder. <> C__DisplayClass8_0.b__0 (services IServiceCollection) chez Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartBuilder. AspNetCore.Hosting.GenericWebHostBuilder. <> C__DisplayClass12_0.b__0 (contexte HostBuilderContext, services IServiceCollection) sur Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider () sur Microsoft.Extensions.Program at.Hosting.Hosting.HostBuilder () [] args) dans /home/juan/code/web-projects/pieshop/src/Program.cs:line 10
Ligne 36 de Startup.cs:
services.AddDefaultIdentity<IdentityUser>()
.AddEntityFrameworkStores<AppDbContext>();
Résolu! J'ai désinstallé les packages dotnet séparément dans l'ordre suivant: dotnet-sdk-bin (AUR) dotnet-runtime-bin (AUR) dotnet-Host-bin (AUR)
Ensuite, j'ai construit ces mêmes packages dans l'ordre inverse. Maintenant, ils sont tous à 3.1.1.sdk101-2 à partir d'aujourd'hui et mon projet est à nouveau en cours d'exécution.
Le problème concerne la dernière version 3.1.1 des packages d'identité ASP.NET Core. Cela fonctionne bien lorsque je reviens à la version stable précédente 3.1.0. Voir ci-dessous un aperçu:
Pour moi, l'installation du dernier SDK et de Core Runtime n'a pas résolu le problème.