1
votes

I am using Visual Studio 2013 on Windows 10, Today I am getting error "No exports were found that match the constraint:"

I did following but still having same issue:

  1. Solution giving in link Error message "No exports were found that match the constraint contract name"

by removing/renaming "ComponentModelCache" folder, but still problem.

  1. Run VS Repair, but still having same problem.

  2. Finally, I Uninstalled Visual Studio 2013 and reinstalled, but still having same problem.

Please suggest what do do now?

3

3 Answers

1
votes

Finally, I did find answer myself, instead of deleting/renaming 'ComponentModelCache' folder in path C:\Users\'username'\AppData\local\Microsoft\VisualStudio\12.0

I renamed folder 'Microsoft' in path C:\Users\'username'\AppData\local\

This works for me.

1
votes

You can see here more solutions which require deleting the cache in %APPDATA%.

In my case, the problem was that I was initializing and using class with the MEF framework but didn't declare the class as a MEF class.

How to import a MEF class:

[Import(typeof(ICalculator))]  
public ICalculator calculator;

How to define and export a MEF class:

public interface ICalculator  
{  
     String Calculate(String input);  
}  

[Export(typeof(ICalculator))]  
class MySimpleCalculator : ICalculator  
{
}

The code example is taken from here

0
votes

Apologies for contributing to an old "answered" thread. however for me, using Win 10, VS 2013. I had to remove the 'ComponentModelCache' folder from each version of VS that I had installed before this issue was resolved.