Property groups being added to PTB are one of the best things to be added to the EpiServer world since, well, PTB itself. Since version 2 has now been released I decided I should try and upgrade our site (CMS 6 R2) which currently used 1.3.1. After downloading and compiling I had “a few” compilation errors:
PageTypeBuilder.PageTypePropertyAttribute’ does not contain a definition for ‘LongStringSettings’
A few in this case meant about a gazillion. The reason for removing this can be read on Joels blog. Fixing this error (which means removing all usages of it) while tedious was not a big problem.
Uses ‘StructureMap, Version=18.104.22.168′ which has a higher version than referenced assembly ‘StructureMap, Version=22.214.171.124′
A brief stop in dll-hell but again, nothing really hard to fix.
No parameterless constructor for PageTypeDefinitionLocator
We use the PTB class PageTypeDefinitionLocator in some internal tests and this class now takes a IAssemblyLocator in it’s constructor. To solve this I simply newed up an instance of the PTB class AppDomainAssemblyLocator.
The site worked as expected but when I tried to run my unit tests I got the following message: “System.TypeLoadException: GenericArguments, ‘SE1177.Core.Presentation.ContactCard.ContactCardPage’, on ‘SE1177.Core.Presentation.IView`1[TPageData]‘ violates the constraint of type parameter ‘TPageData’.”. My first suspicion was that something was changed in PTB, for instance that TypedPageData no longer inhertied from PageData which would cause the generic constraint to fail. But no such change has been made and since the actual web site worked I was very confused. I talked to Joel who suggested that I should verify that I had the correct PTB assembly in the test project too since a diff between assembly versions could give this error.
After some detective work I managed to track down the error to the following: PTB 1.3.1 is compiled against CMS 6 R2 (6.1.379.0) while PTB 2.0 is compiled against CMS 6 (6.0.530.0). The web project has binding redirects for the episerver dlls which explains why the site was working. The unit test project however had no binding redirect. This was not a problem when using PTB 1.3.1 since it was compiled against the version of EpiServer we are using. So all in all it was quite simple to solve, just add binding redirects to the test project too.