.net core 2.1 EF Core 逆向工程错误 VS 2017 [英] .net core 2.1 EF Core reverse engineering errors VS 2017
问题描述
在进行 EF Core 逆向工程方面玩得不开心.
Not having a great time with doing EF Core Reverse Engineering.
最新错误
未实现方法或操作.
Scaffold-DbContext "方法或操作不是已实施"
这两个命令都出现了相同的错误
i get the same errors for both of these commands
在 VS 2017 中从包管理器控制台运行:
Scaffold-DbContext 'Data Source=(localdb)MSSQLLocalDB;Initial Catalog=Chinook' Microsoft.EntityFrameworkCore.SqlServer
并从命令提示符:
dotnet ef dbcontext scaffold "Data Source=(localdb)MSSQLLocalDB;Initial Catalog=Chinook" Microsoft.EntityFrameworkCore.SqlServer
是的,我确实将它们更改为同时拥有我的数据源和数据库.
Yes, I do alter them to have both my data source and database.
我收到此错误
无法加载文件或程序集System.Diagnostics.DiagnosticSource,版本=4.0.3.1,文化=中性,PublicKeyToken=cc7b13ffcd2ddd51'.位于大会的清单定义与程序集引用不匹配.(HRES 的例外超音速:0x80131040)
Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4. 0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRES ULT: 0x80131040)
我在升级到 .net core SDK 2.2.101 之前和之后都得到了这个
仅供参考,我的 csproj 文件看起来像这样
FYI, my csproj file looks like this
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
</ItemGroup>
</Project>
推荐答案
在安装 EF power Tools 和最新的 Core 2.2.xx SDK 之间,我现在可以更改我的项目以使用下拉更改到 .net core 2.2 (以前只能做2.1.
Between installing the EF power Tools and the Latest Core 2.2.x.x SDK I am now able to change my project to use dropdown change to the .net core 2.2 (it was previously only able to do 2.1.
然后通过 Nuget 更新等,它终于可以工作了!
Then with Nuget updates etc.. , it finally works!
这篇关于.net core 2.1 EF Core 逆向工程错误 VS 2017的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!