{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13404","repository_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore","labels_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13404/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13404/comments","events_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13404/events","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/13404","id":363281638,"node_id":"MDU6SXNzdWUzNjMyODE2Mzg=","number":13404,"title":"\"No DbContext found in assembly\" after migrating to EF 2(.1) and ASP.Net Identity Core 2(.1)","user":{"login":"mduu","id":8256317,"node_id":"MDQ6VXNlcjgyNTYzMTc=","avatar_url":"https://avatars3.githubusercontent.com/u/8256317?v=4","gravatar_id":"","url":"https://api.github.com/users/mduu","html_url":"https://github.com/mduu","followers_url":"https://api.github.com/users/mduu/followers","following_url":"https://api.github.com/users/mduu/following{/other_user}","gists_url":"https://api.github.com/users/mduu/gists{/gist_id}","starred_url":"https://api.github.com/users/mduu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mduu/subscriptions","organizations_url":"https://api.github.com/users/mduu/orgs","repos_url":"https://api.github.com/users/mduu/repos","events_url":"https://api.github.com/users/mduu/events{/privacy}","received_events_url":"https://api.github.com/users/mduu/received_events","type":"User","site_admin":false},"labels":[{"id":403965595,"node_id":"MDU6TGFiZWw0MDM5NjU1OTU=","url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/labels/closed-question","name":"closed-question","color":"777777","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-24T19:09:49Z","updated_at":"2018-09-26T18:29:26Z","closed_at":"2018-09-26T15:14:25Z","author_association":"NONE","body":"Describe what is not working as expected.\r\n\r\nI'm working on a Mac with Visual Studio for Mac (and VSCode if needed).\r\n\r\nI try to update my existing .Net Core 1.1, EF Core 1.1, ASP.Net MVC Core 1.1 and ASP.Net Identity Core 1.1 to all the latest versions. After applying lots of tutorials I'm stuck. I decided to restart the MVC app / assembly from scratch by using\r\n\r\n    dotnet new webapp --auth individual\r\n\r\nThis template worked. I then tried to move my cheese over. Especially removing the existing migration and database and using my own `ApplicationDbContext` stored in my \"Common\" assembly. It introduces a new IdentityUser with IdentityRoles on default.\r\n\r\nNow I'm stuck again as I always get the following error messages:\r\n\r\n```\r\n$ dotnet ef migrations add initial\r\nNo DbContext was found in assembly 'Tauchbolde.Web'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.\r\n\r\n$ dotnet ef dbcontext info\r\nNo DbContext was found in assembly 'Tauchbolde.Web'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.\r\n\r\n$ dotnet ef dbcontext list\r\nNo DbContext was found.\r\n```\r\n\r\nI have absolutely no clue anymore what this thing is missing. Any help would be really appreciated.\r\n\r\n### Steps to reproduce\r\n\r\nYou can reproduce by cloning my repo from [GitHub](https://github.com/mduu/tauchbolde) and try to add an initial migration:\r\n\r\n    dotnet ef migrations add initial\r\n\r\n### Further technical details\r\nEF Core version: 2.1 (2.1.3)\r\nDatabase Provider: Previously SqlServer but now on SqlLite\r\nOperating system: macOs High Sierra\r\nIDE: latest Visual Studio for Mac / Latest VS Code\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/comments/424822298","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/13404#issuecomment-424822298","issue_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13404","id":424822298,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDgyMjI5OA==","user":{"login":"mduu","id":8256317,"node_id":"MDQ6VXNlcjgyNTYzMTc=","avatar_url":"https://avatars3.githubusercontent.com/u/8256317?v=4","gravatar_id":"","url":"https://api.github.com/users/mduu","html_url":"https://github.com/mduu","followers_url":"https://api.github.com/users/mduu/followers","following_url":"https://api.github.com/users/mduu/following{/other_user}","gists_url":"https://api.github.com/users/mduu/gists{/gist_id}","starred_url":"https://api.github.com/users/mduu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mduu/subscriptions","organizations_url":"https://api.github.com/users/mduu/orgs","repos_url":"https://api.github.com/users/mduu/repos","events_url":"https://api.github.com/users/mduu/events{/privacy}","received_events_url":"https://api.github.com/users/mduu/received_events","type":"User","site_admin":false},"created_at":"2018-09-26T18:29:26Z","updated_at":"2018-09-26T18:29:26Z","author_association":"NONE","body":"I've tried hard to get it work but still without success. I did decouple my custom User-Entity from the one that Identity provides. So this custom User-Entity setup is gone now. I also ensured the project builds using a Azure Pipeline CI build. It still builds on my machine (Mac).\r\n\r\nI tried to add a migration from within the `/src/Tauchbolde.Web` directory using the following command:\r\n\r\n    dotnet ef migrations add initial --project ../Tauchbolde.Common/Tauchbolde.Common.csproj\r\n\r\nThis results always in the error:\r\n\r\n    Unable to create an object of type 'ApplicationDbContext'. Add an implementation of 'IDesignTimeDbContextFactory<ApplicationDbContext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.\r\n\r\nEven with your link and the one in the above error message I just could not figure what statement will work here. Tried the same statement without the csproj etc.\r\n\r\nI then tried to add a migration from within the `/src/Tauchbolde.Common` directory as this one hosts the `ApplicationDbContext` that should be used.\r\n\r\n    dotnet ef migrations add initial\r\n\r\nHere I get the following error:\r\n\r\n```\r\nThe specified framework version '2.1' could not be parsed\r\nThe specified framework 'Microsoft.NETCore.App', version '2.1' was not found.\r\n  - Check application dependencies and target a framework version installed at:\r\n      /usr/local/share/dotnet/\r\n  - Installing .NET Core prerequisites might help resolve this problem:\r\n      http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409\r\n  - The .NET Core framework and SDK can be installed from:\r\n      https://aka.ms/dotnet-download\r\n  - The following versions are installed:\r\n      1.0.4 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]\r\n      1.1.1 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]\r\n      2.0.0 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]\r\n      2.0.3 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]\r\n      2.0.5 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]\r\n      2.1.2 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]\r\n      2.1.4 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]\r\n```\r\nAs I understand EF Core needs a startup project (like `Tauchbolde.Web`) and a DbContext which in my solution does live in `Tauchbolde.Common`. So I tried to add the migration from `/src` and specify everything:\r\n\r\n    dotnet ef migrations add initial --startup-project ./Tauchbolde.Web/ --project ./Tauchbolde.Common/ -c ApplicationDbContext\r\n\r\nThe error I get here is:\r\n\r\n```\r\nUnable to create an object of type 'ApplicationDbContext'. Add an implementation of 'IDesignTimeDbContextFactory<ApplicationDbContext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.\r\n```\r\n\r\nThe same happened for commands like:\r\n\r\n    dotnet ef dbcontext info\r\n\r\nAs you see I'm really stuck here getting EF Core 2.1 to work and I really could need some help."}}
{"actor":{"display_login":"mduu"}}