Well, today was a lot of fun. You can tell just how much fun from the ridiculous title of this blog post.
I’ve lost most of a productive day to this set of issues. I was seeing some errors being reported by ReSharper 7.1 in my PCL and Xamarin Android solutions and couldn’t work out what the issues were. They compiled without any compiler issues being returned and ran on the various emulators as expected, again without any issues or exceptions. Consdering the error reported by ReSharper was Module ‘System, Version=18.104.22.168, culture-neutral’ should be referenced. An error of that sort, if “real” should mean an application would have trouble even starting up let alone running.
I’ve basically been round the houses trying to sort this out.
Considering the problem centered about MvvmCross I decided to have a look at the source for that so cloned the repository and started having a poke around. Now the first problem you’re going to encounter given the VS2012 and Windows 7 constraints is that Windows Phone requires Windows 8 for development. The WP8 SDKs won’t even install onto Windows 7 so those projects are dead in the water. This target .NETPortable Profile259 which cannot be installed on Windows 7.
So when I opened the MvvmCross solutions on my machine I was seeing some very odd behaviours. You can see some of the weirdness in the following screenshots:
The Cirrious.CrossCore solution targets Profile 259 (the new Profile78 basically with Windows Phone 8.1 support thrown in – unavailable on Windows 7). So what has been happening is any of my own projects that link to this library are trying to resolve system.dll v22.214.171.124 through Profile259. Since I don’t have this profile ReSharper was correctly informing me of an issue but incorrectly informing that I’ll get a compiler error as a result.
In order to arrive at this solution I had upgraded ReShaper from 7.1 to 9.1 only to still see the issue. Reinstalled all of Xamarin and even contemplated a fresh Windows install (not a small task).
The solution turned out to be fairly simple. Kid the system into thinking that my operating system DOES have Profile259 by copying the XML files from:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\SupportedFrameworks
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259\SupportedFrameworks
This doesn’t fix the issues I see when opening the MvvmCross solutions, they still compain about not finding system.dll but it has meant that my solutions that reference Cirrious.CrossCore do not throw up the problem of highlighting “non-issues” in my own projects.
So that was a hell of a learning experience. And I did pull the trigger on an update to ReSharper 9.1 after complaining to JetBrains that 7.1 cost £110 and an upgrade to 9.1 cost £122! So they gave me a 25% discount! Yay!