7

I am rather new to the .NET Core, and I got a .NET Core WebAPI project MyWebApp,
also, i have .Net Core Class Library project MyLib using EntityFrameworkCore

When i try to use Add-Migration, i get the error
The specified deps.json [...\MyWebApp\bin\Debug\netcoreapp1.1\MyWebApp.deps.json] does not exist

Inspecting the folder, I noticed I have this a file in [...\MyWebApp\bin\Debug\netcoreapp1.1\win10-x64\MyWebApp.deps.json]

but i really can't figure what i am supposed to do to resolve this.

myWebApi project.json:

{
  "dependencies": {
  "ShopManager": "1.0.0-*",
  "Microsoft.AspNetCore.StaticFiles": "1.1.0",
  "Microsoft.AspNetCore.Mvc": "1.1.0",
  "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
  "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
  "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
  "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
  "Microsoft.Extensions.Configuration.Json": "1.1.0",
  "Microsoft.Extensions.Logging": "1.1.0",
  "Microsoft.Extensions.Logging.Console": "1.1.0",
  "Microsoft.Extensions.Logging.Debug": "1.1.0",
  "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
  "Microsoft.NETCore.App": "1.1.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },
  "runtimes": {
    "win10-x64": ""
  },
  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}
5
  • Thanks for the review
    – Tomer W
    Jan 11, 2017 at 13:20
  • Remove runtimes section from project.json. As soon as you do not use other runtimes - it's useless. Also, where is Microsoft.EntityFrameworkCore.* packages, why they are not listed in dependencies?
    – Dmitry
    Jan 11, 2017 at 14:07
  • the EFCore.* are on the class lib. and when i remove the RT section i get an error requiring it for .NetCore.App dependency
    – Tomer W
    Jan 11, 2017 at 15:34
  • 3
    Remove runtimes and rewrite dependency as "Microsoft.NETCore.App": { "type": "platform", "version": "1.1.0" }. It's about deployment model and I had some issues developing in "wrong" depl. type.
    – Dmitry
    Jan 11, 2017 at 15:42
  • @Dmitry Thanks, it works, please formulate it as an answer, if you can elaborate a little bit about the dependency types, because from Microsoft's tutorials, I still don't understand what is the differences and why is it needed?
    – Tomer W
    Jan 11, 2017 at 19:13

5 Answers 5

5

runtimes section in project.json looks suspicious. As soon as you build for one runtime only - there is no need to use it.

Remove it and rewrite dependency from "Microsoft.NETCore.App":"1.1.0" to "Microsoft.NETCore.App": { "type": "platform", "version": "1.1.0" }.

This will change your app deployment model from "self-contained" (can run on specific platform even without framework) to "framework-dependent" (may run on any platform with framework installed). Details are here.

4
  • what if i did need to target multiple platform?
    – Tomer W
    Jan 12, 2017 at 16:37
  • You target multiple platforms already. You target ALL platforms where .NET Core is available without runtimes. Runtimes are needed when you want to make "self-contained" distribs of your app (with .NET Core inside), able to run without installing .NET Core on target machine. And if you want this... you should wait for stable tooling (currently you are using preview-4 I guess).
    – Dmitry
    Jan 12, 2017 at 20:46
  • Hey @Dmitry, am using a Mac, but can't see the project.json file. And the .net core SDK am using is version 2.2 Jun 30, 2019 at 12:06
  • @LutaayaHuzaifahIdris SDK v2.2 is the reason why there is no more project.json in your project :)
    – Dmitry
    Jul 1, 2019 at 7:06
1

I had this issue with Visual Studio 2017, I copied all the files including the dll's from the bin\Debug\netcoreapp1.0 to the bin\MCD\Debug\netcoreapp1.0

The scaffolding wasn't working correctly until I copied the files in the bin folder. I am not sure what the MCD folder does but for some reason the scaffolding process looks in this folder.

0

I ran into this issue during a conference workshop today. After running dotnet ef database update -v to get verbose output and carefully inspecting the paths there were used, I discovered that I had an environment variable set on my Mac that was causing the issue.

If you have PROJECTDIR set inside your environment, the dotnet command may use this to resolve paths and if it does, it will most likely do it in an unexpected manner. Therefore, remove this environment variable from the shell/environment where you are doing your .Net core work.

2
  • Am still suffering from this issue but I have no PROJECTDIR env on my MAC Jun 30, 2019 at 16:57
  • Using your comment as a starting point, I remembered I had the Development environment variable set, and no corresponding appsettings.development.json file. As soon as I added that it worked for me
    – Nick
    Oct 13, 2020 at 12:35
0

I had the same issue and realized it was due to having inconsistent build targets in projects. This is what fixed it for me:

  1. Delete all bin and obj folders
  2. Edit project files and solution file to ensure build targets match (e.g. only have debug|x64 and release|x64 everywhere)
  3. Re-open visual studio and rebuild
0

Got this problem when I had multiple projects, even though I had selected my Api project as the default project in PMC, it still didn't work. I had to configure multiple startup projects and it was resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.