entity-framework-coremaui

deps.json does not exist in Entity Framework Core 7 in .NET MAUI app


I am trying to create a migration in an MAUI app.

PM> dotnet ef migrations add Init
Build started...
Build succeeded.
dotnet : The specified deps.json [C:\github\Wa1gonGate\LogGate\bin\Debug\net7.0-android\LogGate.deps.json] does not exist
At line:1 char:1
+ dotnet ef migrations add Init
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (The specified d... does not exist:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

I would really like to have my repo classes in a different project. Is that possible?

Suggestions on this error?


Solution

  • The specified deps.json [...] does not exist

    This is a known issue: The specified deps.json file doesn't exist #22247, and the comment in it said:

    There is a path bug here. The deps file is looked for in the path bin\<Platform>\<TargetFramework>\<TargetFramework>\<Runtime>\

    Note the two occurrences of TargetFramework and the absence of Configuration. My outdir is supposed to be bin\<Platform>\<Configuration>\<TargetFramework>\<Runtime> as specified in my csproj. This command needs to look for the file in the same output folder that msbuild builds to, but it is not.

    Note that I am doing this with the command line tools (dotnet ef migrations). I updated from version 5 to version 7.0.3 and still encounter this bug.

    Copying the output folder to the specified directory is a workaround, though you will have to remember to keep copying it if you need to make changes.

    In Addition, I also found this case: The specified deps.json [...] does not exist. Wish it can help you.