Linux上的ASP.NET Core MVC项目中的身份棚架后问题正在运行的项目

问题描述 投票:0回答:1

我尝试添加

<PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="2.2.0" />

但是目前没有可用的最新版本2.2.0,与错误不匹配。重建应用程序后,错误仍然相同。

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>

完整错误:

未处理的异常。 System.IO.FileNotFoundException:无法加载文件或程序集'Microsoft.AspNetCore.Razor.Runtime,Version = 3.1.1.0,文化=中性,PublicKeyToken = adb9793829ddae60'。系统无法找到指定的文件。

文件名:'Microsoft.AspNetCore.Razor.Runtime,版本= 3.1.1.0,文化=中性,PublicKeyToken = adb9793829ddae60'位于System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule模块,Int32 typeToken,RuntimeTypeHandle [] typeInstantiationContext,的RuntimeTypeHandle [] methodInstantiationContext)System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken,Type [] genericTypeArguments,Type [] genericMethodArguments)System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataTokencaCtorToken,MetadataImport&作用域,RuntimeModule装饰模块,MetadataToken装饰令牌,RuntimeType属性,FilterType,布尔值mustBeInheritable,ListBuilder1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder1&属性,RuntimeModule装饰模块,Int32装饰性MetadataToken,RuntimeType attributeFilterType,布尔值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, Action1 configureOptions)位于Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionUIExtensions.AddDefaultIdentity [TUser](IServiceCollection服务)在pieshop.Startup.ConfigureServices(IServiceCollection)服务)在/home/juan/code/web-projects/pieshop/src/Startup.cs:line中36在System.RuntimeMethodHandle.InvokeMethod(对象目标,Object []参数,签名sig,布尔构造函数,布尔wrapExceptions)System.Reflection.RuntimeMethodInfo.Invoke(对象obj,BindingFlagsinvokeAttr,活页夹活页夹,Object []参数,CultureInfo文化)在Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object例如IServiceCollection服务)Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder。<> c__DisplayClass9_0.g__Startup | 0(IServiceCollectionserviceCollection)Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(对象例如IServiceCollection服务)Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder。<> c__DisplayClass8_0.b__0(IServiceCollection服务)Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(TypestartupType,HostBuilderContext上下文,IServiceCollection服务)在Microsoft.AspNetCore.Hosting.GenericWebHostBuilder。<> c__DisplayClass12_0.b__0(HostBuilderContext上下文,IServiceCollection服务)Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()在Microsoft.Extensions.Hosting.HostBuilder.Build()在pieshop.Program.Main(String [] args)在/home/juan/code/web-projects/pieshop/src/Program.cs:line 10

Startup.cs的第36行:

services.AddDefaultIdentity<IdentityUser>()
    .AddEntityFrameworkStores<AppDbContext>();
c# asp.net-core-mvc entity-framework-core razor-pages asp.net-core-identity
1个回答
0
投票

我注意到了同一件事,请查看该框架的ms更新,几天前有更新,期望已安装了较新的nuget软件包。

您遇到的问题是nuget软件包与您的SDk不匹配,至少这就是我所拥有的。在执行Windows更新并安装新的Core Runtime之后,Version = 3.1.1.0一切正常[]

© www.soinside.com 2019 - 2024. All rights reserved.