【发布时间】:2019-03-01 13:34:17
【问题描述】:
使用Rider 我尝试进行任何类型的迁移。我尝试使用控制台,因为 Rider 没有检测到模型的上下文。
<package id="Microsoft.EntityFrameworkCore.Sqlite" version="2.2.2" targetFramework="net472" />
<package id="Microsoft.EntityFrameworkCore.Sqlite.Core" version="2.2.2" targetFramework="net472" />
<package id="Microsoft.EntityFrameworkCore.Sqlite.Design" version="1.1.6" targetFramework="net472" />
<package id="Microsoft.EntityFrameworkCore.Tools" version="2.2.2" targetFramework="net472" developmentDependency="true" />
using System.Collections.Generic;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
namespace WebApplication1.Models
{
public class Data : DbContext
{
public DbSet<Blog> Blogs { get; set; }
public DbSet<Post> Posts { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Data Source=db.db");
}
}
我在VS中打开项目,可以轻松迁移和更新数据库。
当我尝试在Rider 的终端上调用任何命令时,就会出现问题。
试过dotnet ef add、dotnet ef migrations add AddProductReviews、dotnet ef list。
每次尝试都会以错误结束。
D:\riderproject\WebApplication1\WebApplication1\obj\WebApplication1.csproj.EntityFrameworkCore.targets(4,5):错误 MSB4006:在涉及目标“GetEFProjectMetadata”的目标依赖图中存在循环依赖。 [D:\rider 项目\WebApplication1\Web Application1\WebApplication1.csproj] 无法检索项目元数据。确保它是基于 MSBuild 的 .NET Core 项目。如果您使用自定义 BaseIntermediateOutputPath 或 MSBuildProjectExtensionsPath 值,请使用 --msbuildprojectextensionspath 选项。
我很惊讶我可以使用Visual Studio 轻松迁移,而不是在Rider 的控制台上。
【问题讨论】:
标签: c# entity-framework rider