Thursday, August 9, 2018

SharePoint 2013: One solution to the MissingSiteDefinition upgrade error

Problem

Performed test-SPContentDatabase on a SharePoint 2010 content database restored to the backend of a SharePoint 2013 farm.  These efforts were part of an overall upgrade process from SharePoint 2010 to SharePoint 2016.  Discovered the following error in the resultant report:
13 Sites in database [content database name] have reference(s) to a missing site definition, Id = [6215], Lcid = [1033], compatibility level = [14]. 
The MissingSiteDefinition error was non-upgradeblocking, so, proceeded with mounting this 2010 content database to 2013 web application and upgrading it.  Upgrade completed successfully but with errors, one of which was the MissingSiteDefinition error.  Then launched a site health check TEST and the Site Collection Health Check Results report page listed 13 instances of Missing Site Template issues that had to be fixed or site upgrade would fail.  Interestingly, in the Site Collection Health Checks Results report, these 13 instances do not contain the actual name of the template that is missing, only something like " - #0".  Began troubleshooting.

Troubleshooting

  1. On SharePoint 2010 farm, executed the following in an elevated DOS shell:
    CD C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\
    echo ^ > "D:\report.xml"
    stsadm -o enumallwebs -databasename "[content database name]" -includefeatures -includewebparts -includeeventreceivers -includesetupfiles -includecustomlistview >> "D:\temp\report.xml"
  2. Opened file in browser, and searched for "6215".   Found 13 instances.  Each instance was similar to the following:
    -<Web Id="[web id]" TemplateId="6215" TemplateName="PWS#0" LanguageId="1033" Url="/[web url]">
    Note in particular the template name and ID: PWS#0. 
  3. For one of the webs identified above, checked its source, searching for the g_wsaSiteTemplateId field, and verified the template ID and name as found previously.
  4. Also executed these commandlets in an elevated SharePoint Management Shell to further verify template ID and name:
    (Get-SPweb -Identity [web ID]).WebTemplate
    (Get-SPweb -Identity [web ID]).WebTemplateId
  5. Referring to SharePoint 2010 template listings, found that this template ID and name were associated with the Project Workspace site definition.
  6. Compared the contents of
    ...\TEMPLATE\SiteTemplates\
    on the SharePoint 2010 and 2013 farms (14 and 15 hives), found the PWS folder in
    ...\14\TEMPLATE\SiteTemplates\
    but not in
    ...\15\TEMPLATE\SiteTemplates\.
    Also noted that Microsoft Project was deployed and integrated with our SharePoint 2010 farm but not with our 2013 farm.
  7. Copied entire PWS folder from
    ...\14\TEMPLATE\SiteTemplates\
    on SharePoint 2010 farm to
    ...\14\TEMPLATE\SiteTemplates\ and
    ...\15\TEMPLATE\SiteTemplates\
    on the SharePoint 2013 farm, and then re-executed the Site Collection Health Check, but the 13 Missing Site Template errors still appear in report.  One minor change I noted was that, previously.
  8. Compared the contents of
    ...14\TEMPLATE\1033\XML\
    on the SharePoint 2010 and 2013 farms and found this file
    webtemppwa.xml
    in SharePoint 2010 but not in SharePoint 2013.
  9. Viewing the contents of this file, found an entry referring to "PWS:"
    <Template ID="6215" SetupPath="SiteTemplates\PWS" Name="PWS">
  10. Copied this file from production SharePoint 2010
    [SP2010P]\C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\XML\
    to development 2013
    [SP2013D]\C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\XML\
    ensuring that it is in the same 14 file have on both.
  11. Re-executed the Site Collection Health Check, this time, the 13 missing site template errors appear as " - PWS#0". 
  12. Copied this file from production SharePoint 2010
    [SP2010P]\C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\1033\XML\
    to development 2013
    [SP2013D]\C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\1033\XML\
    ensuring that this time the file is copied to the 15 file hive in the SharePoint 2013 development farm. 
  13. Re-executed the Site Collection Health Check. No upgrade-blocking issues appear.

Solution

  • When "Missing Site Template" errors appearing the Site Collection Health Check Results report, determine the name of the template that is missing, and then copy it from appropriate file hive on the source 2010 farm to both the 14 and 15 file hives in the destination 2013 farm.

References

Notes

  • Site templates are stored in this location:
    [root]:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\[12,14,15,16]\TEMPLATE\SiteTemplates\
  • tbd