by Administrator
8. January 2012 10:52
UPDATED: This has been fixed with the Visual Studio Beta release; it only applies to Developer Preview.
I was pleasantly surprised to find the Portable Class Library project in Visual Studio 2011, this meant I could at least keep my ported Unity Container in my Metro application. All looked good until I went to compile...
My first reaction was to believe that the Portable Class Library was not supported by the WinRt, but research showed that it was. In fact I could create a blank project, create a simple class, and reference it - so this had me scratching my head as to why I was getting this error.
In researching the "Could not load file or assembly...." error, I found that others that have received this error contributed the cause to other issues/errors, it was more or less a catch-all error message. Armed with that I created a Metro project (Gwn.Library.Unity.Metro) and copied all of the files from the Gwn.Library.Unity.Portable project into it.

The following is the result of the compile - I must admit I was surprised; it appears that the Portable Class Library is no longer the least common denominator in multi-targeted applications - the WinRt is.

The System.Type has been trimmed down quite a bit, the missing components moved into TypeInfo. My Unity port is no longer usable under Metro even though it compiles under the Portable Class Library so its use, at this stage, is a risk - we'll see what happens with the next release of Metro