Expand Minimize

SPC060405: Do not deploy files of a Feature as TemplateFile

File which are deployed into the folder of a Feature should not be deployed as TemplateFile. Either deploy the files as ElementFiles in the Feature (preferred) or as Resources in manifest.xml.

CheckId SPC060405
TypeName DoNotDeployFeatureFilesAsTemplateFile
Severity CriticalWarning
Type TemplateFile

Deploy the file as ElementFile in the feature.xml of the target Feature (edit feature.xml) or deploy the file as Resource (edit manifest.xml). See sample below:
Bad Practice

<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="CABB604E-BD2D-4504-8996-196AFF90BEBE">
   ...
   <TemplateFiles>
      <TemplateFile Location="FEATURES\MyFeature\Pages\Category.aspx" />
      ...  
   </TemplateFiles>
</Solution>

Good Practice
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" ... >
   <ElementManifests>
      ...
      <ElementFile Location="Pages\Category.aspx" />
      ...
   </ElementManifests>
</Feature>
Alternative (not recommended):
<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="CABB604E-BD2D-4504-8996-196AFF90BEBE">
   ...
   <ResourceFiles>
      <ResourceFile Location="MyFeature\Pages\Category.aspx" />
      ...  
   </ResourceFiles>
</Solution>

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 AB. 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.