今天早上,我在打开Visual Studio解决方案时遇到了一个问题,当我试图运行它时,它说:

没有找到与约束契约名称匹配的导出

我该如何解决这个问题?


当前回答

我在windows phone的Microsoft Visual Studio Express 2012中尝试打开文件时遇到了这个问题。

然后我浏览到

C:\Users\MyUserName\AppData\Local\Microsoft\VPDExpress\11.0\ComponentModelCache

在ComponentModelCache中,我删除了Microsoft.VisualStudio.Default.cache缓存文件。最后,我重新启动了visual studio并重新启动了我的项目。

然后我的问题解决了,我可以打开文件了。

注意:我的操作系统是windows 8。我安装了SDK 8来开发windows phone应用程序

谢谢

其他回答

对于Visual Studio 2012和更高版本,解决方案必须删除ComponentModelCache文件夹的内容:

C:\Users\[username]\AppData\Local\Microsoft\WDExpress\11.0\ComponentModelCache

Visual Studio 2013

C:\Users\[username]\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache

此问题可以通过删除或清除%AppData%\..\Local\Microsoft\VisualStudio\11.0\ComponentModelCache中的所有文件夹和文件来解决

这实际上清除了Visual Studio组件模型缓存。

在Windows 7的机器上,路径是不同的。当您在运行对话框中输入%appdata%时,它会打开文件夹C:\Users\<username>\ appdata \Roaming。

点击“向上”按钮导航到父文件夹并选择文件夹“Local”。

最终路径:C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\11.0\ComponentModelCache

我的观点是: 遵循以上所有的救生技巧,我的经历略有不同;我的是vs2017社区版,安装了一次,我注意到有这三个文件夹:

%LocalAppData%\Microsoft\VisualStudio\15.0 ==> Empty
%LocalAppData%\Microsoft\VisualStudio\7f0c75b0 ==> has only the CoreCon folder

这是一个有ComponentModelCache的:

%LocalAppData%\Microsoft\VisualStudio\15.0_7f0c75b0

仅删除Microsoft.VisualStudio.Default.cache没有效果。

因此,我删除了所有4个文件:.cache, .err, .external和catalogs。 重新启动VS时,问题消失了,出现了第5个文件:

Microsoft.VisualStudio.Default.scan

两年后,我收到了同样的错误信息。 这次是一个不同的问题,与。net Core dnx有关。

我在Stack Overflow上找不到答案,但有一个GitHub问题包含一个解决方案:https://github.com/aspnet/Home/issues/1455

下面是解决方案中最重要的部分:

Delete the entire C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\DNX directory. (As far as I understand, it belongs to the old version of ASP.NET Core RC1, which for some reason is still shipped even with Visual Studio 2015 Update-3). Delete the C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\14.0\devenv.exe.config file. Run the Developer Command Prompt for Visual Studio 2015 as Administrator, and execute the devenv /setup command. The new devenv.exe.config file is generated. This time there are many assemblies that refer to the C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\DotNet directory. Run the Visual Studio 2015 and check that it shows the Microsoft .NET Core Tools (Preview 2) 14.1.20624.0 in the Help => About Microsoft Visual Studio menu.

感谢olegbroov在GitHub上的帖子,他发现了这一点。

在启动Visual Studio 2013 Ultimate时,我遇到了同样的问题,这里的解决方案对我不起作用。我试着删除上述文件夹并重新启动Visual Studio,但它不起作用。

然而,我也遇到了其他问题,比如微软。visual studio包没有正确加载,页面“312e8a59-2712-48a1-863e-0ef4e67961fc”没有找到VS 2012。后者指的是团队资源管理器窗口中的一条消息,说“无法找到页面‘somenumber’”。

因此,我以管理权限在Visual Studio命令提示符上运行devenv /setup。它成功了,现在一切都好了。