Expand Minimize

Avoid XML comments inside a ContentType definition

Comments inside the ContentType definition (XML) can break loading them.

CheckId SPC015213
TypeName AvoidCommentsInsideContentType
Severity CriticalWarning
Type ContentType

Remove all XML comments from inside the ContentType.
Bad Practice

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ContentType
    Id="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}"
    Name="Amount">
    <FieldRefs>
      <!-- WorkflowInstanceID -->
      <FieldRef ID="{5f47e085-2150-41dc-b661-442f3027f552}" Name="SelectFilename" />
    </FieldRefs>
  </ContentType>
</Elements>

To suppress this violation in XML SharePoint code add the following comment right before the XML tag which causes the rule violation. Learn more about SuppressMessage here.

<!-- "SuppressMessage":{"rule":"SPC015213:AvoidCommentsInsideContentType","justification":"Provide reason for suppression here"} -->
Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.