1

I was told that

when adding the EF6 nuget package to a project it creates an appropriate config file

I've added the EF6 NuGet package to a project, but the App.config file is nowhere to be found. What am I doing wrong, and is the error below a result of this missing config file (am I chasing the wrong horse)?

VS Screenshot

The goal is to run the following, View Entity Data Model:

enter image description here

Where the result should look like this:

I get the following cryptic error:

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.Shell.Interop.IVsAggregatableProject'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{FFB2E715-7312-4B93-83D7-D37BCC561C90}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at Microsoft.DbContextPackage.Extensions.ProjectExtensions.GetProjectTypes(Project project)
   at Microsoft.DbContextPackage.Extensions.ProjectExtensions.IsWebProject(Project project)
   at Microsoft.DbContextPackage.DbContextPackage.GetUserConfig(Project project, String assemblyFullName)
   at Microsoft.DbContextPackage.DbContextPackage.DiscoverUserContextType(Type& systemContextType)
1
  • Make sure you copy the connection info from app.config file where the diagram is and add it to the app.config of the start up application project. Commented Jan 1, 2020 at 22:42

1 Answer 1

1

It is probably due to not pre set the current Data model projects as "startUp project"

So the solution is obvious you should select the model projects the one that contains the Context class and click on that project with "Set as StartUp Projects".

Once you will do so and the exception will be solved.

Sign up to request clarification or add additional context in comments.

1 Comment

Please one more topic to consider, if you use .net core you should use entity framework which is compatible to . net core.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.