.net-8.0asp.net-core-identity

The Specified deps.json Does Not Exist... Even Though It Does


Visual Studio 2022 (17.11.6) .Net 8.0

I have a project where I currently need to update my model after I added a field to the DB. I run the following scaffolding command using the Package Manager Console:

Scaffold-DbContext 'Name=ConnectionStrings:'Entities' Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Force -Context EntityContext

It successfully builds the project, but then throws the following error:

The specified deps.json [\\SomeServer\ThisProject\bin\Debug\net8.0\ThisProject.deps.json] does not exist

However, if I copy that exact folder path (except the leading two escape slashes) and paste it into Windows Explorer, it brings me to that folder and the file "ThisProject.deps.json" is in there.

I have tried deleting the "obj" and "bin" and ".vs" folders. No change. I have tried deleting the "ThisProject.deps.json" file itself. It just gets recreated every time I build the project. I have tried updated Visual Studio. No change. I have tried updated all my Entity Framework packages. No change. I have tried setting this as the default project (there is only one project in this solution so I don't see how that would matter anyway). No change.

I will note that where I work requires me to run this project as admin.


Solution

  • Use Scaffold-dbcontext and Add-Migration command, it will show the error message The specified deps.json [\\SomeServer\ThisProject\bin\Debug\net8.0\ThisProject.deps.json] does not exist if we are executing from a network drive that begins with two slashes. i.e. "\SomeServer...".

    And it is working perfectly on local drive.

    Related Links

    The specified deps.json [\\TeamDrive\IT\Team Software\Project\etc...] does not exist#14349

    deps.json not found due to extra backslashes being added to search path for a network drive beginning with '\' #21048