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.

Tuesday, August 20, 2013

Solution to "Microsoft C/C++ Optimizing Compiler has stopped working"

Out of the blue I got error below when building a Visual Studio solution.

After googled and try few suggested solutions, here's the working solution for me.

1. Clean the solution.
2. Use msbuild to rebuild the solution.

That's it. Ah, you may need an elevated VS command prompt for the msbuild command, if your solution has some build step requires more privilege, which is not related to this issue actually.