錯誤消息“未找到與約束合同名稱匹配的導出”

本文翻譯自:Error message “No exports were found that match the constraint contract name”

This morning I faced a problem while opening my Visual Studio solution, and when I tried to run it, it said: 今天早上我在打開Visual Studio解決方案時遇到了問題,當我嘗試運行它時,它說:

No exports were found that match the constraint contract name 未找到與約束合同名稱匹配的導出

How can I fix this problem? 我該如何解決這個問題?


#1樓

參考:https://stackoom.com/question/1BpfD/錯誤消息-未找到與約束合同名稱匹配的導出


#2樓

I solved this problem by clearing Visual Studio Component Model Cache. 我通過清除Visual Studio組件模型緩存解決了這個問題。

Just delete or rename this folder: 只需刪除或重命名此文件夾:

%LocalAppData%\Microsoft\VisualStudio\11.0\ComponentModelCache

or 要麼

%LocalAppData%\Microsoft\VPDExpress\11.0\ComponentModelCache

and restart Visual Studio. 並重新啓動Visual Studio。

The version of Visual Studio you have is specified by the number eg 您擁有的Visual Studio版本由數字指定,例如

Visual Studio 2012 is 11.0 (as shown above) Visual Studio 2012是11.0 (如上所示)

Visual Studio 2013 is 12.0 Visual Studio 2013是12.0

Visual Studio 2015 is 14.0 Visual Studio 2015是14.0

Visual Studio 2017 is 15.0 Visual Studio 2017是15.0

For those that don't know: %LocalAppData%\\ is the same as C:\\Users\\{yourUsername}\\AppData\\Local 對於那些不知道的人: %LocalAppData%\\C:\\Users\\{yourUsername}\\AppData\\Local

For those who have multiple versions of Visual Studio installed, eg 2012 and 2013, it might help to remove the ComponentModelCache for both versions before restarting Visual Studio, eg 11.0 and 12.0. 對於那些安裝了多個Visual Studio版本的用戶,例如2012和2013,在重新啓動Visual Studio之前刪除兩個版本的ComponentModelCache可能會有所幫助,例如11.0和12.0。


#3樓

Visual Studio Express 2012 has different paths. Visual Studio Express 2012具有不同的路徑。

Visual Studio Express Visual Studio Express

  • ...\\Users\\{user}\\AppData\\Local\\Microsoft\\WDExpress\\11.0\\ComponentModelCache ... \\用戶\\ {用戶} \\應用程序數據\\本地\\微軟\\ WDExpress \\ 11.0 \\ ComponentModelCache

With Visual Studio Express 2012 for Web 使用Visual Studio Express 2012 for Web

  • ...\\Users\\{user}\\AppData\\Local\\Microsoft\\VWDExpress\\11.0\\ComponentModelCache ... \\用戶\\ {用戶} \\應用程序數據\\本地\\微軟\\ VWDExpress \\ 11.0 \\ ComponentModelCache

I did not have to re-install Visual Studio Express 我沒有必要重新安裝Visual Studio Express


#4樓

No need to rename or delete the whole folder: 無需重命名或刪除整個文件夾:

(%AppData%\..\Local\Microsoft\VisualStudio\11.0\ComponentModelCache)

Just rename or delete the Microsoft.VisualStudio.Default.cache file inside the above location. 只需重命名或刪除上述位置內的Microsoft.VisualStudio.Default.cache文件。


#5樓

Deleting the Component Model Cache did not work for me (well, the relative directory given above did not exist in my machine). 刪除組件模型緩存對我來說不起作用(好吧,上面給出的相關目錄在我的機器中不存在)。 Instead, I installed an extension to Visual Studio 2012 Express . 相反,我安裝了Visual Studio 2012 Express的擴展。 Menu Tools → *Extensions and Updates...** → OnlineChoose any and then download. 菜單工具 →*擴展和更新... **→ 在線選擇任何然後下載。 This apparently invalidates the cache causing Visual Studio to rebuild it. 這顯然使緩存無效,導致Visual Studio重建它。

Here's my source . 這是我的來源


#6樓

This issue can be resolved by deleting or clearing all the folders and files from %AppData%\\..\\Local\\Microsoft\\VisualStudio\\11.0\\ComponentModelCache 可以通過刪除或清除%AppData%\\..\\Local\\Microsoft\\VisualStudio\\11.0\\ComponentModelCache所有文件夾和文件來解決此問題

This actually clears the Visual Studio component model cache. 這實際上清除了Visual Studio組件模型緩存。

On Windows 7 machines, the path is different. 在Windows 7計算機上,路徑不同。 When you type %appdata% in Run dialog, it opens the folder C:\\Users\\<username>\\AppData\\Roaming . “運行”對話框中鍵入%appdata%時,將打開文件夾C:\\Users\\<username>\\AppData\\Roaming

Click the 'up' button to navigate to the parent folder and select the folder 'Local'. 單擊“向上”按鈕導航到父文件夾,然後選擇“本地”文件夾。

Final path: C:\\Users\\<username>\\AppData\\Local\\Microsoft\\VisualStudio\\11.0\\ComponentModelCache 最終路徑: C:\\Users\\<username>\\AppData\\Local\\Microsoft\\VisualStudio\\11.0\\ComponentModelCache

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章