I can't find a CAML based solution to the following problem, I appreciate that if I created/edited the content type using the object model it would probably be OK but for this situation I need to use CAML.
I have the following content type hierachy, in reality it is more complicated with more types but the below serves to demonstrate.
BaseContentType : Item
DerivedContentType : BaseContentType
MoreDerivedContentType : DerivedContentType
In the elements.xml file where I define the content types I have the following (simplified) definition for BaseContentType:
<ContentType ID="0x010088168591bb094583a2d63c13d73293a5"
Name="[Name]"
Group="[Group]"
Description="[Description]"
FeatureId="86b34829-09ab-4591-9646-55898bb4241d"
Inherits="TRUE">
<FieldRefs>
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="FALSE" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInNewForm="FALSE" Sealed="TRUE" />
<FieldRef ID="{7612E6EF-BEC7-480A-9820-2F7EDD1D945F}" Name="AnotherField" DisplayName="AnotherField" Required="FALSE" />
</FieldRefs>
</ContentType>
As you can see I am trying to change the visibility and required status of the built-in title field, I could equally be using RemoveFieldRef, the behaviour is the same. With the above definition my feature activates OK but the changes to the Title field are not made. It is visible and required in all content types. This seems to be well documented online, here for example - http://msmvps.com/blogs/windsor/archive/2011/05/02/custom-content-types-and-inherits-in-sharepoint-2010.aspx - it is discussed very clearly. The generally accepted solution is to set Inherits="FALSE" and then SharePoint honours the changes to the inherited fields.
However when I set inherits to false I get the following error:
The parent content type specified by content type identifier 0x010088168591BB094583A2D63C13D73293A5 does not exist
There seems to be a combination of undocumented and unexpected behaviour here. Inherits doesn't work as defined in the docs and has some unexpected side effects. One of these is that multiple inherited content types seem to be impossible without inherits set to true.
Can anyone provide a clearer understanding of this and possibly a declarative solution?