0

Using Rider I try to do any kind of migration. I tried using console because Rider does not detect the context of the model.

 <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");
        }
    }

I opened the project in VS and can easily migrate and update the database. The problem occurs when I try to call any command at the terminal in Rider. Tried dotnet ef add, dotnet ef migrations add AddProductReviews, dotnet ef list. Each attempt will end with an error.

D:\riderproject\WebApplication1\WebApplication1\obj\WebApplication1.csproj.EntityFrameworkCore.targets(4,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "GetEFProjectMetadata". [D:\rider project\WebApplication1\Web Application1\WebApplication1.csproj] Unable to retrieve project metadata. Ensure it's an MSBuild-based .NET Core project. If you're using custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option.

I am surprised that I can easily migrate with Visual Studio and not at the console in Rider.

BillIT
  • 53
  • 1
  • 14

1 Answers1

1

The solution to the problem is to go to the folder in which the project is located and from there call the command.

BillIT
  • 53
  • 1
  • 14