When using Visual Studio 2012 to upgrade an existing WP7.1 project to WP8 the process failed with the message:
Upgrade to the project could not be completed. This reference cannot be removed from the project because it is always referenced by the compiler.
Upgrade to the project could not be completed. Error HRESULT E_FAIL has been returned from a call to a COM component.
I found the solution in the post Upgrade Windows Phone 7.1 project to Windows Phone 8?
My project was missing the reference to System.Core.dll before attempting the upgrade. The was a reference to mscorlib.dll.
For some unknown reason attempting to add the System.Core reference to the project from Visual Studio didn't work. It would check in the add dialog but wouldn't then be present in the list of references.
In the end I needed to manually add the reference to the project via notepad.
After that the reference appeared as required in Visual Studio and the upgrade to the Windows Phone 8 project succeeded.