Error message "No exports were found that match the constraint contract name" - visual-studio

This morning I faced a problem while opening my Visual Studio solution, and when I tried to run it, it said:
No exports were found that match the constraint contract name
How can I fix this problem?

I solved this problem by clearing Visual Studio Component Model Cache.
Just delete or rename this folder:
%LocalAppData%\Microsoft\VisualStudio\11.0\ComponentModelCache
or
%LocalAppData%\Microsoft\VPDExpress\11.0\ComponentModelCache
and restart Visual Studio.
The version of Visual Studio you have is specified by the number e.g.
Visual Studio 2012 is 11.0 (as shown above)
Visual Studio 2013 is 12.0
Visual Studio 2015 is 14.0
Visual Studio 2017 is 15.0
Visual Studio 2019 is 16.0
For those that don't know:
%LocalAppData%\ is the same as C:\Users\{yourUsername}\AppData\Local
For those who have multiple versions of Visual Studio installed, e.g. 2012 and 2013, it might help to remove the ComponentModelCache for both versions before restarting Visual Studio, e.g. 11.0 and 12.0.

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.

Visual Studio Express 2012 has different paths.
Visual Studio Express
...\Users\{user}\AppData\Local\Microsoft\WDExpress\11.0\ComponentModelCache
With Visual Studio Express 2012 for Web
...\Users\{user}\AppData\Local\Microsoft\VWDExpress\11.0\ComponentModelCache
I did not have to re-install Visual Studio Express

This will really work like a champ:
Solution: Try to delete ComponentModelCache folder from the below location.
[C:]\Users\[your user name]\AppData\Local\Microsoft\VisualStudio\[Visual Studio version number]
And after successful delete, recreate the folder with the same name, "ComponentModelCache".

This issue can be resolved by deleting or clearing all the folders and files from %AppData%\..\Local\Microsoft\VisualStudio\11.0\ComponentModelCache
This actually clears the Visual Studio component model cache.
On Windows 7 machines, the path is different. When you type %appdata% in Run dialog, it opens the folder 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

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. Menu Tools → Extensions and Updates... → Online → Choose any and then download. This apparently invalidates the cache causing Visual Studio to rebuild it.
Here's my source.

For Visual Studio 2013 you need to remove that folder from this path:
%AppData%\..\Local\Microsoft\VisualStudio\12.0

for Visual Studio 2012 and later versions, the solution must be deleting the content of the folder ComponentModelCache:
C:\Users\[username]\AppData\Local\Microsoft\WDExpress\11.0\ComponentModelCache
Visual Studio 2013
C:\Users\[username]\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache

I had the same problem upon launching Visual Studio 2013 Ultimate, and the solutions here didn't work for me. I tried deleting the mentioned folders and starting Visual Studio again, but it didn't work.
However I had other problems too, like Microsoft.visual studio package did not load correctly and also Page '312e8a59-2712-48a1-863e-0ef4e67961fc' not found VS 2012. The latter refers to a message in the Team Explorer window saying "Page 'somenumber' cannot be found".
So I run devenv /setup on the Visual Studio command prompt with administrative rights. It did the job, and everything is fine now.

Remove ComponentModelCache folder content.
%AppData%..\Local\Microsoft\VisualStudio\11.0\ComponentModelCache

Clearing the folders didn't work for me. So I went to 'Programs and Features' and used the change button to startup the Visual Studio 2013 setup.
In the setup I choose the repair function and that fixed the problem for me.

I had the same problem with Visual Studio Express 2013 of Windows 8.1.
Unfortunatly there was no "ComponentModelCache" folder in
%AppData%..\Local\Microsoft\VisualStudio\12.0\ComponentModelCache.
I found the "ComponentModelCache" folder in
..\Users[username]\AppData\Local\Microsoft\WDExpress\12.0
and solved this problem by removing this folder from there.

If you have VS 2013, you have to go to: %LOCALAPPDATA%\Microsoft\VisualStudio\12.0
then rename the ComponentModelCache folder.

I experienced a similar problem after some updates released from Microsoft (part of them where about .NET framework 4.5).
On the Internet I got the following link to the Microsoft knowledge base article:
Update for Microsoft Visual Studio 2012 (KB2781514)
It worked for me.

This happened to me with Visual Studio 2013 Web, after Windows installed several updates. Unfortunately none of the suggestions in this thread helped.
I had to re-run the installer and select the "Repair" option. After that (and a reboot) it was working once again.
In some cases you may have to repair more than one version of Visual Studio. One example is when a Script Task control in VS 2013 opens VS 2012 when you click Edit Script.

Renaming the ComponentModelCache folder worked for me in Visual Studio 2015, but with a slightly different path:
%AppData%\..\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

I have Windows 7 x64 with a second partition on which Windows 8 (preview installed). While working with Microsoft Visual Studio Express 2012 for Windows Phone, I come up with the same problem. But the ComponentModelCache is found here:
C:\Users\Jayaram\AppData\Local\Microsoft\VPDExpress\11.0
I am unable to delete or rename as I get the "access is denied" message when I try to use command prompt:
Administrator: VS2012 X64 CrossToolsCommandPrompt

This issue is because of a MEF cache corruption.
Installing the feedback extension (or installing any extension) will invalidate the cache causing VS to rebuild it.
click for source.

i experienced this problem in Microsoft Visual Studio Express 2012 for windows phone while trying to open file.
Then i browsed to
C:\Users\MyUserName\AppData\Local\Microsoft\VPDExpress\11.0\ComponentModelCache
And Inside ComponentModelCache i deleted Microsoft.VisualStudio.Default.cache CACHE file. Finaly i restarted visual studio and reopened my project.
Then my problem was solved, i was able to open file.
Note: My OS is windows 8. And i installed SDK 8 for developing windows phone app
Thanks

I am using Visual Studio 2012. After installing the Visual Studio 2013 web express, when I want to run or open any project in Visual Studio 2012 it shows me the following error:
"no exports were found that match the constraint contract name".
I also tried the above solution for clearing the ComponentModelCache,
but I did not find the folder. I solves my problem just by: Repair Visual Studio 2012
For the Express versions of the software, the folder you need is in a slightly different place(s): For Express 2012 for Web it is C:\Users\XXXXXXXX\AppData\Local\Microsoft\VWDExpress - not in the Visual Studio folder.

I got an error with the same error message - two years later.
It's a different problem this time though, related to .NET Core dnx things.
I couldn't find an answer on Stack Overflow, but there's a GitHub issue that contains a workaround: https://github.com/aspnet/Home/issues/1455
Below is the most important part of the workaround:
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.
Thanks to olegburov's post on GitHub for figuring this out.

I had to uninstall some external components like Postsharp and Apex and then it worked. I also tried the chosen solution but it gave me more errors.

Deleting the folders haven't worked for me i have go control panel and repaired
Visual Studio Installer Projects extensions for VS 2013.
And it worked for me

I got this error after reinstalling IntelliJ IDEA and ReSharper for C# in Visual Studio 2013.
First, I got an error problem with extensions, and after this I got this error:
"No exports were found that match the constraint contract name”
I simply removed folder ComponentModelCache and resolved this error.

My 2 cents:
Following all above lifesaving tips, I had a slightly different experience; mine is VS 2017 Community Edition, installed once, and I notice that have all these 3 folders:
%LocalAppData%\Microsoft\VisualStudio\15.0 ==> Empty
%LocalAppData%\Microsoft\VisualStudio\7f0c75b0 ==> has only the CoreCon folder
This is the one that has the ComponentModelCache:
%LocalAppData%\Microsoft\VisualStudio\15.0_7f0c75b0
Deleting only the Microsoft.VisualStudio.Default.cache had no effect.
So, I deleted all 4 files there: .cache, .err, .external and catalogs.
On restarting VS, problem gone and appeared a 5th file:
Microsoft.VisualStudio.Default.scan

Removing ComponentModelCache did not work for me. Reinstalling VS 2019 did thanks to a recommendation on this Microsoft support thread.
Details
This seems to be a known bug with a fix incoming from MS (as of 1/7/2020)
Experienced after upgrading from VS2019 Pro 16.2 (i think it was?) to 16.4.2 using Visual Studio Installer
Error displayed when trying to launch both nuget console and nuget package manager

Related

Visual Studio Installer Project Extension running in VS 2017 Pro thinks it's running in VS 2013 Pro

Got a big problem with the Visual Studio 2017 Installer Projects Extension for Visual Studio 2017 Professional. I added a Visual Studio Installer Setup project to a solution and set it up the way it's basically supposed to be done (Primary Output in the Application Folder and an icon in the Desktop Folder is all that was needed). Then I right-clicked on the Setup project, clicked "Build" and then I get this:
Please wait while Windows configures Microsoft Visual Studio Professional 2013.
And then it stalls indefinitely. I have to close Visual Studio in Task Manager to stop everything. What's more, I'm Visual Studio Professional 2017, not 2013. I used to have Visual Studio 2013 Ultimate, but I uninstalled it. What could possibly be causing the confusion?
It appears that you have also got Visual Studio 2013 installed, and that there is as conflict between 2013 and 2017 because that message is a Windows Installer repair of VS 2013. Something is happening during your build that requires the VS 2013 installation to be repaired. The Windows Event Log (Application) will have an MsiInstaller log entry saying which component appears to be broken. If you post that information there may be a clue to the problem. If you (for example) have manually removed anything that may belong to the VS 2013 installed product then that would cause the same kind of problem.
You have this similar problem:
Rebuilding Visual Studio Installer project, launches Visual Studio 2013 seetup
Visual Studio 2015 msi build initiates another installation
When you say it stalls indefinitely, I would expect it to ask for the Visual Studio 2013 install image so that it can repair it. If you go to Programs&Features and manually repair VS 2013 it might fix the problem.
I also had Visual Studio 2013 installed as mentioned by #PhilDW.
Navigating to Event Viewer → Windows Logs → Application I found loads of warnings:
Detection of product '{9C593464-7F2F-37B3-89F8-7E894E3B09EA}', feature 'Visual_Studio_Professional_x86_enu', component '{E3FF99AA-78B9-4A06-8A74-869E9F65E1FE}' failed. The resource 'C:\WINDOWS\Microsoft.NET\Framework\URTInstallPath_GAC\' does not exist.
The key here being that the folder C:\WINDOWS\Microsoft.NET\Framework\URTInstallPath_GAC\ did not exist thanks to an answer in the first link provided by #PhilDW.
Created the missing final folder URTInstallPath_GAC in the path mentioned and the installers now build really fast whereas before they used to take forever (sometimes literally!).

VS 2013 giving The operation could not be completed. Invalid pointer on Razor views

I installed VS 2015 version on my system. I already had Visual studio 2013 update 4 installed on my machine. But now, whenever I try to open any cshtml ( razor view) in VS 2013, I get following error:
Microsoft Visual Studio
The operation could not be completed. Invalid pointer
OK
Please suggest me its solution.
For anyone arriving here after installing Visual Studio 2015 Update 1 and then updating some packages, here is what fixed it for me:
Close Visual Studio
Delete %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Re-open Visual Studio
I was getting this error message in VS2015 and the fix worked for me, so it seems to apply to 2013 and 2015.
I found the solution on another Stack Overflow question: Visual Studio 2015 Broken Razor Intellisense.
Installing Visual Studio 2015 Update 1 fixed this for me:
https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx
Sometimes it helps to delete Solution User Options (.Suo) File. In my case it was the evil and worked for me.
I'm not sure what ended up fixing it, but I closed Visual Studio and opened up developer tools, and ran devenv /SafeMode which starts it with no extensions installed. I then navigated and opened up the solution in the instance and it worked. It complained about source control bindings and removed those (This solution used to be in a TFS project and now it's in a git tfs project). Then after saving it and closing visual studio I was able to re-open the solution from file explorer.
I'm not sure if it was the devenv or the source control bindings that fixed it, or just restarting visual studio for the umpteenth time, but it appears to work now.
I have the same error and I have tried the following with NO SUCCES
“%ProgramFiles%\Common Files\Microsoft Shared\VS7DEBUG” to something
else. I changed it to VS7DEBUG1.
Delete the content of
%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Installed Servicing Update
(KB3110221) -
https://blogs.msdn.microsoft.com/visualstudioalm/2016/01/26/servicing-update-available-for-visual-studio-update-1/
C:\Program Files (x86)\Microsoft Visual Studio14.0\Common7\IDE\devenv.exe /resetuserdata
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe
/resetsettings
I finally uninstalled visual studio 2015. Restarted and installed it again and then it worked.
Sometimes it is just a matter of closing Visual Studio 2015 and then open again.
I have had this happen on a few machines.
This does happen
"Have you tried to delete the "Your_Solution_FileName.suo" file?"
Also computer crashing like e.g. power outage etc...
I managed to get rid of this error by a combination of the answers here plus some more:
Close Visual Studio
Delete %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Delete the .suo file
Re-open Visual Studio - the same error
Edit the .csproj file - >go to the
ProjectExtensions/VisualStudio/FlavorProperties, delete the entire
FlavorProperties element.
Reload the project
try
reopening solution
renaming the solution file (.sln) to something else
deleting of "ProjectExtensions"

VS 2013 Express for Desktop wont open vcxproj project files

I am trying to open the Direct3D Tutorial Win32 Samples with VS 2013 Express for Windows Desktop. To my surprise it claims that the individuals projects in the solution each cannot be opened because their project types (.vcxproj) are not supported by this version of the application.
Does anyone know why the vcxproj files cannot be opened, or how I could diagnose and repair the root cause of the problem?
Edit: I can also not open the vcxproj files in Mike Farnsworth's Rayito project.
It means that the projects were created in another version of Visual Studio.
Try to upgrade the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting Upgrade Solution.
Alternatively you could use Visual Studio 2012 Express Edition to see if that resolves the problem.
Windows Dev Center indicates that Visual Studio 2012 is required.
Hope this helps
Neither of the other answers seemed to help.
I uninstalled visual studio. I uninstalled SQL server. I reinstalled visual studio. Now it loads C++ projects correctly.
I understand a previous install of visual studio can cause the problem I was having. Apparently so can installing SQL server Express prior to installing Visual Studio 2013 Express.

Visual Studio 2012 "Invalid license data. Reinstall is required"

I have a newly built Windows 8 VM with VS 2012 Premium running on it, when I try open any sln file I get the following modal pop up error
Visual Studio 2010 Shell
Invalid license data. Reinstall is required.
I can open the sln's if I open up VS and then do project open, this is really annoying, any ideas how I fix it?
*Note I have done a VS repair and it didn't solve it...and I never had any VS RC release on the machine, all new build with s/w downloaded from the MSDN
Cheers
I encountered the same exact error when I created a solution with a full version of Visual Studio 2012 Professional on one machine and then tried to open the solution file with a copy of Visual Studio 2012 Express on a different machine. I got the error when double-clicking the solution file, but not when loading the solution into an already opened instance.
I fixed the error by opening the solution file (.sln) with notepad and changing the line that says Visual Studio 2012 to say Visual Studio Express 2012 for Windows Desktop.
After that, I was able to double-click to open the solution file on the machine that has Express installed.
I'm using VS 2013. I fixed this by right clicking the .sln and setting the Open With parameter to visual studio 2013 and not VS version selector or VS 2010.
I have faced the same problem. When I set the system Date and Time to the current Date and Time, The Problem solved by itself.
It looks like the .sln extension is owned by "Visual Studio 2010 Shell" a minimal version of Visual Studio that ships with products like SQL Server and Office to provide support for add-in development without any other features. Since this is a minimal version, it's unable to load any project type that ships with Visual Studio Express, Professional or above.
The same may happen when you have Visual Studio Express installed next to a full version of Visual Studio.
This may happen when you install an older version of Office or SQL Server after having installed Visual Studio. The old installer will hijack the extension.
To repair this problem:
use the "Open With" option of Windows and select the "Visual Studio Version Selector" as your default action.
Or open the "Default Programs" option in Windows, look up the .sln extension and make sure it uses the "Visual Studio Version Selector" as default:
Or locate Visual Studio 2012 in the Programs and Features window of Windows and chose "Change", the Visual Studio installer will pop up, chose "Repair" to have it repair the file associations and any other problems that may arise by installing Visual Studio versions in reverse order (it may for example mess up the MsBuild directory as well).
Remember that when Visual Studio 2010 was released, it could not yet know what Visual Studio 2012 would change, as such, it's best to install versions of Visual Studio in the order they were released. This may sometimes prove difficult, as other products may install Visual Studio versions without you knowing.

PROBLEM encountered visual studio 2008 installation

I installed Visual Studio 2008 package FULL option. It worked with out any problem. I installed Vstudio 2008 and MSDN in separate folder in the D drive. 2 days later in order to remove my projects i uninstalled every thing and also i deleted visual studio 2008, visual studio 2005 folders from C:\Documents and Settings\IRCTC\My Documents. (I believe these 2 folders were automatically created when we install visual studio) also I cleared %path% and path (c/windows/path). Again I installed VISUAL STUDIO 2008 but now I can't able to create window application (other web, vb also), what is the solution for this ...
ERROR that shown is
c:/documents and settings/IRCTC/local settings/temp/g1zzsdl.bak/temp/windowsFormsApplication.csproj cannot be opened because project type (.csproj) is not supported by this version of visual studio.......
Whether any system file corrupted (windows temp or .net folber in windows).....
No other installation problem found in my system.....
please help.....
What are the files/folders required for the installation......
When you get that error is usually because:
You are trying to open a project created with a previous version of Visual Studio (not your case)
There was a bit of a screw-up during the installation (sounds like your case)
I'd uninstall the thing and reinstall completely first thing.
If it still doesn't work, it could be related to VS templates and you might wanna try and run from Visual Studio 2008 command prompt:
devenv /InstallVSTemplates
If it still doesn't work, open Visual Studio, in the menu, Open Tools->Options->Projects and Solutions->General. At this point you will notice the path of Project Templates is set to "C:\Documents and Settings[yourUserName]\My Documents\Visual Studio 9\Templates\ProjectTemplates" or something very similar to that. In order to fix it you gotta set that path to C:\Program Files\Microsoft Visual Studio 9\Common7\IDE\Project Templates or the same path according to wherever you installed Visual Studio
I don't think is related to VS project Templates though - see this link
Try and see what happens!
Why didn't you use visual studio's uninstall function available from the control panel|add/remove programs?
I would uninstall the latest installation as described above, and try again.

Resources