_From @JoasE on February 12, 2019 8:53_
User)DbContext to the project and include a DbSet<User>dotnet ef migrations add Initial --verboseRepro repo: https://github.com/JoasE/ReproDotnetEFError
A migration is created.
>dotnet ef migrations add Initial --verbose
Using project 'C:\Users\Joas\source\repos\TestApp\TestApp\TestApp.csproj'.
Using startup project 'C:\Users\Joas\source\repos\TestApp\TestApp\TestApp.csproj'.
Writing 'C:\Users\Joas\source\repos\TestApp\TestApp\obj\TestApp.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\Joas\AppData\Local\Temp\tmpE710.tmp /verbosity:quiet /nologo C:\Users\Joas\source\repos\TestApp\TestApp\TestApp.csproj
Writing 'C:\Users\Joas\source\repos\TestApp\TestApp\obj\TestApp.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\Joas\AppData\Local\Temp\tmpEABA.tmp /verbosity:quiet /nologo C:\Users\Joas\source\repos\TestApp\TestApp\TestApp.csproj
dotnet build C:\Users\Joas\source\repos\TestApp\TestApp\TestApp.csproj /verbosity:quiet /nologo
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.14
dotnet exec --depsfile C:\Users\Joas\source\repos\TestApp\TestApp\bin\Debug\netcoreapp2.1\TestApp.deps.json --additionalprobingpath C:\Users\Joas\.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig C:\Users\Joas\source\repos\TestApp\TestApp\bin\Debug\netcoreapp2.1\TestApp.runtimeconfig.json "C:\Program Files\dotnet\sdk\2.2.103\DotnetTools\dotnet-ef\2.2.1\tools\netcoreapp2.2\any\tools\netcoreapp2.0\any\ef.dll" migrations add Initial --assembly C:\Users\Joas\source\repos\TestApp\TestApp\bin\Debug\netcoreapp2.1\TestApp.dll --startup-assembly C:\Users\Joas\source\repos\TestApp\TestApp\bin\Debug\netcoreapp2.1\TestApp.dll --project-dir C:\Users\Joas\source\repos\TestApp\TestApp\ --language C# --working-dir C:\Users\Joas\source\repos\TestApp\TestApp --verbose --root-namespace TestApp
Error:
An assembly specified in the application dependencies manifest (TestApp.deps.json) was not found:
package: 'TestApp', version: '1.0.0'
path: 'TestApp.dll'
dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.2.103
Commit: 8edbc2570a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.103\
Host (useful for support):
Version: 2.2.1
Commit: 878dd11e62
.NET Core SDKs installed:
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.102 [C:\Program Files\dotnet\sdk]
2.1.103 [C:\Program Files\dotnet\sdk]
2.1.104 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.1.402 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.503 [C:\Program Files\dotnet\sdk]
2.2.103 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
_Copied from original issue: dotnet/cli#10751_
Moving to EF for initial investigation. It seems the tool was invoked correctly from the logs above.
netcoreapp2.1.DbContext in the class library project aswell.IDesignTimeDbContextFactory in the class library project. (see: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dbcontext-creation)dotnet ef migrations add command from within the class library project or use the --project argument to specify the class library's .csproj file.Duplicate of #14084
Is anyone (@ajcvickers perhaps) aware of an open issue page where I can follow this issue (specifically concerning the '.deps.json' error) or of the official solution? Also, I'm sorry if there is something that I overlooked. I don't mean to waste anyone's time. Please assist and thank you ahead of time. :)
My current status
The issue
Research
All of the Github articles I can find about this issue (specifically concerning the '.deps.json' error), or at least those that are referenced in other articles, including this one, are closed and I didn't notice a solution, just that they were merged into something else. For example:
I noticed that a couple more issues pages are referenced as being replacements for possible duplicates. I read those and they are similar or may be where this issue stems from, but I didn't notice a reference to this specific error in either:
@tjorxwrynch As far as I am aware, the last two Azure Functions issues are the best place to follow up on this.
@tjorxwrynch As far as I am aware, the last two Azure Functions issues are the best place to follow up on this.
Thank you @ajcvickers!
Yes! I am getting this error as well tried EFcore 2.0.0 and latest 2.2.4 . This is offcourse trying to create an azure function, as a standalone console or app it works fine (well in 2.2.4 not testing in 2.0.0) .
Please help microsoft, has any one tried version 3?
BTW EF Core Power Tools plugin has allowed me to create the model
I have used this workaround and now I get numerous "dbset is defined in an assembly that is not referenced" errors in the AzureFunction project. So that leads you down another rabbit hole of issues, and another, until you just give up.
The reason for this error that Azure function does some organising to build artefacts with a certain structure and it moves dlls to subdirectory different from the project.dll.
To fix that you need to add PostBuildEvent.
By one of the following option:
1- Edit your project file by adding the following: (Work on windows only)
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT' ">
<Exec Command="copy /Y "$(TargetDir)bin\*.dll" "$(TargetDir)*.dll"
" />
</Target>
or
2- Right-click on your startup project, Properties -> Build Events tab and paste copy command
copy /Y "$(TargetDir)bin\*.dll" "$(TargetDir)*.dll"

and this script will copy dlls to the proper place.
Most helpful comment
The reason for this error that Azure function does some organising to build artefacts with a certain structure and it moves dlls to subdirectory different from the project.dll.
To fix that you need to add PostBuildEvent.
By one of the following option:
1- Edit your project file by adding the following: (Work on windows only)
or
2- Right-click on your startup project, Properties -> Build Events tab and paste copy command
and this script will copy dlls to the proper place.