Ryan Taite
Ryan Taite

Reputation: 839

MVC Scaffolding Error, deps.json does not exists

I'm following along with the Contoso University and I'm running into the HP Computer Platform issue mentioned in this SO question about the scaffolding creation error saying deps.json does not exists in a certain folder.

I'm running Windows 7 Professional and using Visual Studio 2017 Community.

I have changed my Environment Variable, Platform, from BPC to nothing by using set Platform= in command prompt.

Still I get an error when I try to Right Click on the Controllers folder > Add > New Scaffolding Item... > MVC Controller with views, Using Entity Framework > Fill out the form by picking a Model class and Data context class > Add >

Error

There was an error running the selected code generator:
'The specified deps.json [C:\...\bin\BPC\Debug\netcoreapp1.1\ContosoUniversity.deps.json] does not exists'

I have tried cleaning cleaning the solution, restarting Visual Studio 2017, and rebooting my computer to no avail. Not sure what else I should do to prevent this error. Any suggestions? I feel like copying the files into the BPC folder is a workaround, but not the best solution.

Edit 1

I noticed that the Environment Variable, Platform, got reset to BPC, so I deleted it and rebooted again. Didn't come back.

Now when I try to create the scaffold I get this error:

Error

There was an error running the selected code generator:
'Value cannot be null.
Parameter name: connectionString
  at
Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b_6_0()
  at
Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
  at
Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)'

Edit 2

Setting the Platform variable back to BCP manually brings back the original error.

Copying and pasting all files from ...\ContosoUniversity\bin\Debug\netcoreapp1.1\ to ...\ContosoUniversity\bin\BCP\Debug\netcoreapp1.1\ gets me past that error, but the error from Edit 1 comes back.

Seems I have two separate problems.

Upvotes: 0

Views: 1174

Answers (2)

Ryan Taite
Ryan Taite

Reputation: 839

Turns out I made a typo in appsettings.json

I had "ConnectionString" instead of "ConnectionStrings" with an 's'

That was causing my Value cannot be null. Parameter name: connectionString error

So, to solve my original problem, follow these steps for Windows 7. (10 shouldn't be much different):

Windows key > Right click on Computer > Properties > Advanced system settings > Environment Variables... > Under System variables find Platform > Highlight Platform > Delete > OK

Upvotes: 1

Amad
Amad

Reputation: 314

make sure .json file exists in path specified. and let me know about that what you find.

Upvotes: 0

Related Questions