Wednesday, August 21, 2013

Error "No exports were found that match the constraint" in creating new WPF project using Visual Studio 2012

After Windows update (not really sure which updates since IT department in my workplace automated the installation process and it run silently) I was getting error when creating new WPF application project using Visual Studio 2012. The error message is as below.

No exports were found that match the constraint:
     ContractName
Microsoft.VisualStudio.Text.ITextDocumentFactoryService
     RequiredTypeIdentity
Microsoft.VisualStudio.Text.ITextDocumentFactoryService



The solution is easy. Close all instances of VS 2012, go to C:\Users\{userName}\AppData\Local\Microsoft\VisualStudio\11.0 and delete ComponentModelCache folder. Attempt to create WPF application project and it should works fine.

Happy coding.