Tuesday 30 April 2013

Invalid Associated Content Type

Recently I have been working on a project creating custom publishing page content types and layouts in Visual Studio.  All seemed fine, the deployment went as expected and off I went to create my new page based on the custom content type / page layout I had created. After selecting the content type from the menu I was redirected to the create page when i noticed that the page layout option was preceded with the words "(invalid Associated Content Type)".  Having never seen this before I was at a lost.  I did a quick retract and deploy to see if something had gone wrong during the deploy to no avail.  Being a bit lost at this point i fired up chrome and copied the error message into google.  A quick scan of a few websites revealed my problem.  It seems you need to reference the content type in the content type like so:-

<FieldRef ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" />

A quick redeploy and test verified that this did indeed solve my problem.  Don't ask me why!!!!!!

No comments:

Post a Comment