Fix for the "No exports were found that match the constraint: ContractName" error.
This error cropped up while modifying a Windows 8 Phone program using Microsoft Visual Studio Express 2012 for Windows Phone. It was just a simple multi-page program which brings up details of my books from the main screen. The program was working correctly as shown in the screen shots:
The links on the MainPage.xaml would bring up the linked pages as shown for one of them:
While trying to access the pages, the above error would show up. This happened right after a Windows Update. Interestingly opening the project in Blend for Visual Studio 2012 allowed modifications to the pages but when opened in Visual Studio always resulted in the above message.
This error and some remedies can be accessed here:
One of the fixes calls for deleting a folder , ComponentModelCache which is supposed to be present at a certain location. However depending on the build, version etc. it can be in different places. For the program used here (highlighted),
Microsoft Visual Studio Express 2012 for Windows Phone
It is found at this location:
Directory of C:\Users\<username.\AppData\Local\Microsoft\VPDExpress\11.0
08/09/2013 01:00 PM <DIR> .
08/09/2013 01:00 PM <DIR> ..
08/09/2013 12:44 PM <DIR> 1033
08/09/2013 12:43 PM <DIR> Extensions
08/09/2013 12:44 PM <DIR> ComponentModelCache
08/09/2013 12:15 PM 19,248 VPDExpress.exe.config
08/09/2013 08:52 AM 38 vspdmc.lock
08/09/2013 01:00 PM <DIR> VTC
2 File(s) 19,286 bytes
6 Dir(s) 5,137,149,952 bytes free
Surprisingly this folder could not be removed as access was denied even with elevated permissions. The Windows 8 OS used here is on a second partition of Windows 7 x64 bit lap top.
Finally the problem disappeared after upgrading the Visual Studio 2012 Express with Update 3 which updated the current version: 11.0.50727.1 to 11.0.60610.01
The only reason for the error appears to be the Windows Update.