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.

TypeName: DoNotDeployFeatureFilesAsTemplateFile
CheckId: SPC060405
Severity: CriticalWarning
Type: TemplateFileReference
Resolution

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>

Links

comments powered by Disqus