No DbContext was found in assembly 'ef' exception when assembly is named 'EF' in project.csproj file #8035
Labels
closed-out-of-scope
This is not something that will be fixed/implemented and the issue is closed.
customer-reported
Getting a
No DbContext was found in assembly 'ef'
exception when I rundotnet ef add InitialMigration -p EF.csproj -c MFIDataContext
. This happened after I ran dotnet migrate. Prior to this It would have added the migration. Same error occurs when listing dbcontexts or migrations.Using project 'EF.csproj'.
Using startup project '/home/mziyabo/Documents/Projects/MFI/EF/EF.csproj'.
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=/tmp/tmpddFRok.tmp /verbosity:quiet /nologo EF.csproj
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=/tmp/tmp0OXR4U.tmp /verbosity:quiet /nologo /home/mziyabo/Documents/Projects/MFI/EF/EF.csproj
dotnet build /home/mziyabo/Documents/Projects/MFI/EF/EF.csproj /verbosity:quiet /nologo
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:11.88
dotnet exec --depsfile /home/mziyabo/Documents/Projects/MFI/EF/bin/Debug/netcoreapp1.1/EF.deps.json --additionalprobingpath /home/mziyabo/.nuget/packages --runtimeconfig /home/mziyabo/Documents/Projects/MFI/EF/bin/Debug/netcoreapp1.1/EF.runtimeconfig.json /home/mziyabo/.nuget/packages/microsoft.entityframeworkcore.tools.dotnet/1.0.0/tools/netcoreapp1.0/ef.dll migrations add InitialMigration --assembly /home/mziyabo/Documents/Projects/MFI/EF/bin/Debug/netcoreapp1.1/EF.dll --startup-assembly /home/mziyabo/Documents/Projects/MFI/EF/bin/Debug/netcoreapp1.1/EF.dll --project-dir /home/mziyabo/Documents/Projects/MFI/EF/ --content-root /home/mziyabo/Documents/Projects/MFI/EF/ --data-dir /home/mziyabo/Documents/Projects/MFI/EF/bin/Debug/netcoreapp1.1/ --verbose --root-namespace EF
Using assembly 'EF'.
Using startup assembly 'EF'.
Using application base '/home/mziyabo/Documents/Projects/MFI/EF/bin/Debug/netcoreapp1.1'.
Using content root '/home/mziyabo/Documents/Projects/MFI/EF/'.
Using root namespace 'EF'.
Using project directory '/home/mziyabo/Documents/Projects/MFI/EF/'.
Using data directory '/home/mziyabo/Documents/Projects/MFI/EF/bin/Debug/netcoreapp1.1/'.
Finding DbContext classes...
Microsoft.EntityFrameworkCore.Design.OperationException: No DbContext was found in assembly 'ef'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextType(String name)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
No DbContext was found in assembly 'ef'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
Steps to reproduce
Add Assembly Line parameter as 'EF' to .csproj file containing EF code:
<AssemblyName>EF</AssemblyName>
Run line below in terminal:
dotnet ef add InitialMigration -p EF.csproj -c MFIDataContext
Further technical details
Command Line Tools (1.0.0-preview4-004233)
Information:
Version: 1.0.0-preview4-004233
Commit SHA-1 hash: 8cec61c6f7
Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/1.0.0-preview4-004233
The text was updated successfully, but these errors were encountered: