Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scaffolding error : deps.json doesn't exist

I'm currently using VS2017 for developing .NET Core MVC Web

When I tried to create a new Controller from Add > Controller, I got this error

Error

There was an error running the code generator: "The specified deps.json
[C:\Users\xxx\Documents\Visual Studio 2017\Projects\bin\MCD\Debug\netcoreapp1.1
\[project name].deps.json] does not exist"

When I explored the solution folder, I found that there are two folder in the bin directory, Debug and MCD.

bin
|
- Debug
 - netcoreapp1.1
  - ...
  - [project name].deps.json
|
- MCD <- this is where the scaffolding looks for deps.json

I noticed that I also got the same problem when debugging .NET Console app (which I created from dotnet new console cli command) from Visual Studio Code. The same problem faced in .deps.json could not be found

Are there any .NET Core configs that I missed? Or this is a bug in .NET Core? I remember I didn't configure anything prior from installing my .NET Core in VS2017

like image 500
Muhamad Iqbal Avatar asked Mar 13 '17 05:03

Muhamad Iqbal


People also ask

What is DEPS json?

deps. json will mean the host will blindly enumerate all . dll files in the application directory and use those as the "entire app". This typically means: Portable apps may not work (building with no RID specified will produce a portable app)

Where is .net global json?

The . NET SDK looks for a global. json file in the current working directory (which isn't necessarily the same as the project directory) or one of its parent directories.

Where do I put global json files?

NET Core project is to add a global. json file into the project main folder. Placing this global. json into the solution folder gives the same results.


3 Answers

In my case, this error appeared after the VS update. Don't know why, but what I did:

  1. Go to your project folder and just remove the bin and obj folders.
  2. Rebuild your project.
  3. Add your new controller. It should work.

Perhaps it will help someone.

like image 50
Ivan Sivak Avatar answered Oct 02 '22 23:10

Ivan Sivak


Found the answer here : https://github.com/dotnet/coreclr/issues/113

Apparently, this is some kind of bug that appeared on HP computers. I'll quote from the GitHub issue :

they have an environment variable called Platform, set to MCD which is why you are seeing this error.

This cause .NET Core to look for the file at MCD folder of your bin, instead of your normal Debug file. All you have to do is delete the variable or set it to nothing

like image 25
Muhamad Iqbal Avatar answered Oct 03 '22 00:10

Muhamad Iqbal


I had the problem with EF/add-migration in VS Comunity 16.9.3. My start project (bold in solution explorer) was set to one without EF. I switched that to the EF project and add-migration worked fine.

like image 3
Jens Mander Avatar answered Oct 03 '22 01:10

Jens Mander