The specified deps.json [] does not exist

Viewed 6035

I'm using Asp.net Core with EntityFramework.Core. I'm having troubleshot migrations and Scaffold after format my pc.

when I write these in Package Manager Console

Scaffold-DbContext "Data Source=.\SQL2017DEV;Initial Catalog=MyDataBase;Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Db

Add-Migration Initial

error is "The specified deps.json [D:\TFS\Erdi\Erdi\AspCoreWeb.Site\AspCoreWeb.Site.deps.json] does not exist"

[MyProjectFolder]\AspCoreWeb.Site.deps.json

I think it try to find my debug folder.

This solutioun is working other computers

I'm repair my visual studio but it hasn't changed

7 Answers

In my case; was fixed by changing the Startup Project (via Solution Properties) to the project that has EF Context file.

There is an issue with migration in VS2019. I have been facing a similar issue and was getting below error:

The specified deps.json [YourProjectLocation]\ProjectName.deps.json doesn't exists.

When I used dotnet CLI for migrations and it worked and was able to generate migration and update the same using dotnet CLI.

dotnet ef migrations add InitialCreate dotnet ef database update

this problem generally occurs because of path issues. You should change your "outputPath" in the "project.assets.json" file.

D:\TFS\Erdi\Erdi\AspCoreWeb.Site\AspCoreWeb.Site.deps.json]  instead of this, 

D:\TFS\Erdi\Erdi\AspCoreWeb.Site\obj\AspCoreWeb.Site.deps.json]

i think this will resolve your problem.

If you are using Package Manager Console to "Add-Migration" or "Update-Database", be sure that the project where you want the migration is selected as the Startup project in Visual Studio and this project is also the default in Package Manager Console.

Solution Explorer:

enter image description here

Package Manager Console: enter image description here

If you are using the dotnet CLI, then you have to navigate to the right project folder and run the migration commands from there.

Make sure that the Startup Project is where the connection string is and select the project in the Default project of Package Manager Console where the db context is at.

Just Go to VS 2022 It Worked for me

go to bin folder and copy files in it include deps.json to the path that see in error.

Related