Visual Studio 2012 Error: No exports were found that match the constraint in…

I use a Windows 8 Virtual Machine for any Windows Phone 8 app development I do. I hadn’t fired up my VM for quite a while and there were a whole host of Windows updates to be installed.

After installing the updates and running Visual Studio 2012, I tried to load one of my Windows Phone App solutions. When trying to view any of the pages in Visual Studio, I received the error:

No exports were found that match the constraint:
ContractName
Microsoft.VisualStudio.Project.IProjectServiceAccessor
RequiredTypeIdentity
Microsoft.VisualStudio.Project.IProjectServiceAccessor

Very annoying considering that before the updates were installed everything worked fine. To overcome the issue, what you can do is delete the folder ComponentModelCache, which can be found in this path:

C:\Users\<<user>>\AppData\Local\Microsoft\VisualStudio\11.0\ — where <<user>> is the users folder.

This has worked fine for me and looking at Google, has worked for many other people.

Running Windows Phone 8 Emulator Outside of Visual Studio 2012

Sometimes it is useful to be able to run the Windows Phone 8 emulator without having to create a solution within Visual Studio 2012. Most of the time I am testing apps that I am writing, so launch through Visual Studio, but I have had the need to not do this. After a bit of Googling, the answer became quite clear on how to do this. Never one to keep useful snippets of information to myself, I’ve given the steps below on how to do it.

1. As an administrator, open a command prompt window
2. Navigate to the folder C:\Program Files (x86)\Microsoft XDE\8.0 (CD Program Files (x86)\Microsoft XDE\8.0)
3. Execute the following command: xde -vhd “c:\program files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images\Flash.vhd”

The emulator should then execute as expected. If you have installed the SDK to a different location, you will need to modify the folders/drive specified above, but if you have a default installation, the above should work fine.