ContentType fields (FIELDREF) missing from ELEMENTS.XML

When creating a custom content type, the Visual Studio 2010 story is a little better, with the ability to simply click "New > Content Type", but it’s still a little clunky.

I’ve been defining some new Content Types in a feature, but I’ve had to manually determine the GUIDs for particular fields – and/or include Field definitions in a separate feature, and then use those same GUIDs.

I’ve discovered another quirk that annoyed me for an hour or more.

The following Content Type (example) includes THREE fields – I’ve had to source the GUIDs for these fields from elsewhere – using some PowerShell commands.

And – so that I can check back later, I’ve included a HTML comment for each field.


My content type feature deploys – no error – and looks to be OK – but was only adding the FIRST field.

I probably spent an hour or two checking the columns GUID’s and trying to just add ONE field – and it turned out to be the COMMENT block – WTF !?

Yes – that line with the HTML/XML comment was actually causing the rest of the columns to be skipped (somehow).

So – just needed to remove that line – and the fields added successfully.


So – it would appear that COMMENTS are not allowed within the XML – even though it’s “valid” – strange.

Hope that helps you save a few hours…(!)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s