The Visual Studio team recently announced fourth preview of their upcoming “Update 2”. As it includes many new features including support for their own Git plugin & Windows Phone unit testing, I wanted to give it a try.
One other thing that was recently announced is the Portable HttpClient, which basically adds HttpClient support for Portable Class Libraries (PCLs). If you haven’t heard about PCLs yet, check them out as they’re definitely interesting when doing .NET development for multiple target platforms.
I was very keen to try these both (we actually had a very good reason to use the Portable HttpClient) so I installed a CTP and started a new project with the HttpClient. Surprisingly, I got compilation errors for this very simple part of code
That last line gave me the following errors:
- The type ‘System.Net.HttpStatusCode’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Net, Version=126.96.36.199, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes’.
- Cannot implicitly convert type ‘System.Net.HttpStatusCode’ to ‘System.Net.HttpStatusCode [c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile78\System.Net.Primitives.dll]’
That code is completely valid and any combination of rebuild/clean/restart didn’t solve the problem. After going through the uninstall/install/repair route of VS2012 / Update 2 CTP & WP8 dev tools, I had no other explanation to the problems that there has to be something wrong with the update.
So I filed a bug about this to Connect. True enough, my woes got answered in a couple of days and (as you can see) after a couple of replies with additional info, Microsoft confirmed that there indeed is a problem when Update 2 CTP 4 is installed after WP8 development tools. Great! Err, or not so great, I don’t know. At least now they’re aware of it and it wasn’t just my that was messed up.
Happily enough, the workaround suggested by Microsoft (repair the Update 2 CTP 4 installation) fixed the issue.