[英]Entity Framework 6 App.config file is not created
有人告诉我
将 EF6 nuget 包添加到项目时,它会创建一个适当的配置文件
我已将 EF6 NuGet 包添加到项目中,但找不到 App.config 文件。 我做错了什么,下面的错误是由于缺少这个配置文件导致的吗(我是不是在追错马)?
VS 截图
目标是运行以下内容,查看Entity Data Model
:
结果应该是这样的:
我收到以下神秘错误:
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)
可能是因为没有将当前的数据模型项目预先设置为“启动项目”
因此,解决方案很明显,您应该选择包含 Context 类的模型项目,然后使用“设置为启动项目”单击该项目。
一旦你这样做了,异常就会得到解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.