运行所选代码生成器时出错数据库提供者尝试注册'IRelationTypeMappingSource'的实现 [英] Error running selected code generator The database provider attempted to register an implementation of 'IRelationTypeMappingSource'

查看:62
本文介绍了运行所选代码生成器时出错数据库提供者尝试注册'IRelationTypeMappingSource'的实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2019.

I'm using Visual Studio 2019.

在重新安装Visual Studio之前,我的ASP.NET Core MVC项目和脚手架工作正常.

Before reinstalling visual studio my ASP.NET Core MVC project and scaffolder was working fine.

但是在那之后,我无法添加新的脚手架项目.

But after that I'm not able to add new scaffolded item.

通过更新所有NuGet软件包,然后运行脚手架,它将自动使软件包降级

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="Migrations\20200625063143_user_table_added_for_access_control.cs" />
    <Compile Remove="Migrations\20200625063143_user_table_added_for_access_control.Designer.cs" />
    <Compile Remove="Migrations\20200625070609_test.cs" />
    <Compile Remove="Migrations\20200625070609_test.Designer.cs" />
    <Compile Remove="Migrations\20200701100225_datatype_changed_to_long_of_assetno_in_both_table.cs" />
    <Compile Remove="Migrations\20200701100225_datatype_changed_to_long_of_assetno_in_both_table.Designer.cs" />
    <Compile Remove="Migrations\20200730114532_hasShiftingRequest_field_added_in_pc.cs" />
    <Compile Remove="Migrations\20200730114532_hasShiftingRequest_field_added_in_pc.Designer.cs" />
    <Compile Remove="Migrations\20200731033230_hasShiftingRequest_field_added_in_pc.cs" />
    <Compile Remove="Migrations\20200731033230_hasShiftingRequest_field_added_in_pc.Designer.cs" />
    <Compile Remove="Migrations\20200917095552_trial.cs" />
    <Compile Remove="Migrations\20200917095552_trial.Designer.cs" />
    <Compile Remove="Migrations\20201208042418_test.cs" />
    <Compile Remove="Migrations\20201208042418_test.Designer.cs" />
    <Compile Remove="Migrations\20201208054030_User_table_mapped_with_laptop_and_desktop.cs" />
    <Compile Remove="Migrations\20201208054030_User_table_mapped_with_laptop_and_desktop.Designer.cs" />
  </ItemGroup>

  <ItemGroup>
    <Content Remove="Views\AssetDataLaptops\Delete.cshtml" />
    <Content Remove="Views\AssetDataPcs\Delete.cshtml" />
    <Content Remove="Views\AssetShiftings\Delete.cshtml" />
    <Content Remove="Views\AssetShiftings\Details.cshtml" />
    <Content Remove="Views\AssetShiftings\Edit.cshtml" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="bootstrap" Version="4.6.0" />
    <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.11" />    
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.11" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.11">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Office.Interop.Excel" Version="15.0.4795.1000" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="3.1.4" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
    <PackageReference Include="System.DirectoryServices" Version="5.0.0" />
    <PackageReference Include="System.DirectoryServices.AccountManagement" Version="5.0.0" />
  </ItemGroup>



</Project>

将EntityFrameworkCore 5降级为3.x后出现构建错误

Getting build error after degrading EntityFrameworkCore 5 to 3.x

推荐答案

由于您的项目版本为3.1,因此您不应使用包< PackageReference Include ="Microsoft.EntityFrameworkCore";版本="5.0.2"./> .

Because your project version is 3.1,you should not use package <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />.

您需要将其更改为3.x.

You need change it to 3.x.

这篇关于运行所选代码生成器时出错数据库提供者尝试注册'IRelationTypeMappingSource'的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆