簡體   English   中英

未創建實體框架 6 App.config 文件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM