Expand Minimize

Do not deploy Taxonomy fields using ListTemplate.

Taxonomy fields should be deployed by content types, not inside ListTemplates.

CheckId SPC015511
TypeName DoNotDeployTaxonomyFieldsInListDefinition
Severity CriticalError
Type ListTemplate

Create a Field of type 'TaxonomyFieldType', add it to a ContentType and then add a ContentTypeRef to the ListTemplate. See sample below.
Bad Practice

<List xmlns:ows="Microsoft SharePoint" Title="MyList" ... >
   <MetaData>
      <Fields>
         <Field  
            ID="{c3a92d97-2b77-4a25-9698-3ab54874bc6f}"  
            Name="MyTaxonomyField"  
            Type="TaxonomyFieldType"  
            ...>
         </Field>
         ...
</List>

Good Practice
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   <Field
      ID="{c3a92d97-2b77-4a25-9698-3ab54874bc6f}"  
      Name="MyTaxonomyField"  
      Type="TaxonomyFieldType"  
      ...>
   </Field>
   <ContentType ID="[YourContentTypeID]" ...>
      <FieldRefs>
         <FieldRef ID="{c3a92d97-2b77-4a25-9698-3ab54874bc6f}" Name="MyTaxonomyField"/>
      </FieldRefs>
   </ContentType>
</Elements>

<List xmlns:ows="Microsoft SharePoint" Title="MyList" ... >
   <MetaData>  
      <ContentTypes>
         <ContentTypeRef ID="[YourContentTypeID]" />
      </ContentTypes>
      ...
</List>

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":"SPC015511:DoNotDeployTaxonomyFieldsInListDefinition","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.