错误消息“未找到与约束合同名称匹配的导出”

当尝试运行Visual Studio解决方案时遇到'未找到与约束合同名称匹配的导出'的问题。解决方法包括清除组件模型缓存,删除特定版本的ComponentModelCache文件夹,或者在Visual Studio Express 2012中更改路径。如果以上方法无效,可以尝试安装Visual Studio扩展来重建缓存。
摘要由CSDN通过智能技术生成

本文翻译自: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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值