我试过添加
<PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="2.2.0" />
Run Code Online (Sandbox Code Playgroud)
但是 2.2.0 是目前可用的最新版本,与错误不符。重建应用程序后错误仍然相同。
项目.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>
Run Code Online (Sandbox Code Playgroud)
完整错误:
未处理的异常。System.IO.FileNotFoundException:无法加载文件或程序集“Microsoft.AspNetCore.Razor.Runtime,版本=3.1.1.0,Culture=neutral,PublicKeyToken=adb9793829ddae60”。该系统找不到指定的文件。
文件名:'Microsoft.AspNetCore.Razor.Runtime,版本=3.1.1.0,Culture=neutral,PublicKeyToken=adb9793829ddae60' at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule 模块,Int32 typeToken,RuntimeTypeHandle[] typeInstantiationContext),方法IntimeContext[] System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) 在 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken …
c# entity-framework-core asp.net-core-mvc asp.net-core-identity razor-pages