Visual studio 2019 如何将CSharpEntityTypeGenerator拉入项目?

Visual studio 2019 如何将CSharpEntityTypeGenerator拉入项目?,visual-studio-2019,ef-core-3.0,Visual Studio 2019,Ef Core 3.0,我看到很多帖子都在谈论如何子类化csharpentytytypegenerator来修改efcore写出的内容。Visual studio不喜欢这样,并要求安装Microsoft.EntityFrameworkCore.Design。我已经安装了v3.1.0-preview1.19506.2 然而,VS仍然表示它无法找到该类并安装NuGet包 有什么神奇的东西能让这一切成功 我想编写一个这样的类,以便添加#nullable disable,并插入GeneratedCode属性 公共类Entity

我看到很多帖子都在谈论如何子类化
csharpentytytypegenerator
来修改efcore写出的内容。Visual studio不喜欢这样,并要求安装
Microsoft.EntityFrameworkCore.Design
。我已经安装了v3.1.0-preview1.19506.2

然而,VS仍然表示它无法找到该类并安装NuGet包

有什么神奇的东西能让这一切成功

我想编写一个这样的类,以便添加
#nullable disable
,并插入
GeneratedCode
属性

公共类EntityTypeGenerator:CSharpEntityTypeGenerator
{
公共EntityTypeGenerator(ICSharpHelper帮助程序):基本(帮助程序){}
公共重写字符串WriteCode(IEntityType类型,字符串@命名空间,bool useDataAnnotations)
{
var code=base.WriteCode(类型,@namespace,useDataAnnotations);
var old=“public partial class”+type.Name;
var updated=“[System.CodeDom.Compiler.GeneratedCode]\n”+old;
返回代码.Replace(旧的,更新的).Replace(“名称空间”,“可空禁用\n\nnamespace”);
}
}

更新项目文件中的引用:


全部的

我也不得不移除私有资产,然后它就开始工作了。谢谢