Sunday, May 12, 2013

Fix File not found error after upgrade from Sharepoint 2010 to 2013

In one of my previous posts I wrote about one major problem which we faced after performing site collections upgrade from 2010 to 2013 mode (see File not found error after upgrade of customizations from Sharepoint 2010 to 2013). On the moment of writing the previous post we had one working workaround, which required direct modification of the content database (change values in SetupPathVersion column in AllDocs table from 4 to 15). Also I wrote that we opened a primary support ticket in MS, but unfortunately all suggestions which we got from MS support didn’t work in our case.

As sites should go to production soon and we didn’t find exact reason and solution for this problem, we decided to go by other way: we decided to replace all page layouts and master pages by new ones, which will be installed only to 15 folders. And this workaround really worked. So what we did:

  1. Created list of all page layouts and masterpages, used in the migrated sites.
  2. Copied all of them as is, without modifications, but with new file names. It is important to not change web part zones during this process, because if e.g. Id of web part zone would be changed, we would lost the content after replacing of the original page layouts. For file names we used the following rule: [old file name] + “2013” + [old extension], i.e. if old file name was foo.aspx, then new is foo.2013.aspx.
  3. Created new feature which contains new page layouts and masterpages, provisioned it and activated on the sites.
  4. Created PowerShell scripts which recursively changed masterpages on all sub sites and page layouts of all publishing pages.

There were several new problems, caused by this workaround (e.g. we needed to change available page layouts setting for the sub sites, in order to give content producers possibility to create new pages using new page layouts), but original File not found error has gone after this. And since this solution didn’t require direct modifications of the content database, it was accepted for production use.

Hope that this information will help you. And we are still interested in the actual reasons of this problem, so if you know another solution, please share it in the comments.

Update 2013-05-13. Rainer D├╝mmler shared another solution in the email conversation, and I with his approval put it here (already asked, but one more time: Rainer, create own blog :) ). His solution contains from several steps:

  • When you migrate the SP 2010 Solution to SP 2013 give the SP 2013 solution a new Solution ID.
  • Install SP 2010 solution to 14 hive and SP 2013 solution to 15 hive on SP2013 server.
  • Give all site definitions (onet.xml) in SP 2013 solution a higher Revision number for example:
   1: <Project Title="Migrationtest" Revision="3" .../>
  • Then you need an Upgrade xml file (destination: {SharePointRoot}\CONFIG\UPGRADE\) where you add a webtemplate element for every site definition you use:
   1: <?xml version='1.0'?>
   2: <!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
   3: <Config xmlns="urn:Microsoft.SharePoint.Upgrade">
   4:   <WebTemplate
   5:       ID="..."
   6:       LocaleId="*"
   7:       FromProductVersion="4"
   8:       BeginFromSchemaVersion="0"
   9:       EndFromSchemaVersion="2"
  10:       ToSchemaVersion="3">
  11:   </WebTemplate>
  12: </Config>
  • Attach SP 2010 content database to SP 2013.
  • Do visual upgrade:
    Upgrade-SPSite -Identity <url>
  • Close and reopen powershell console:
    Upgrade-SPSite -Identity <url> -VersionUpgrade
  • Have a look at the database - paths of the upgraded sitecollection have changed
Interesting solution from my point of view.

Update 2013-07-07. Solution described above fixes problem for publishing pages and masterpages. However there is one more issue which we found after upgrade. All images in Site collection images document library, which were in the library before upgrade, returned HTTP 404 File not found error when tried to open them by direct URL. Interesting that inside Site collection images doclib all images thumbnails were shown.

The problem occurs only when you try to open specific file. Also new images uploaded to Site collection images after upgrade work properly, i.e. they are opened successfully without File not found. As these images were used before upgrade on the publishing pages (and in other content) by URL, in order to fix this issue it was enough to delete all upgraded images and then re-upload them to the Site collection images with the same file names (we copied original images from old SP2010 sites, because it was also not possible to copy files from Site collection images doclib on upgraded SP2013 site using explorer view). After that they started to work properly.

2 comments:

  1. Hello Alex,
    I am facing the same problem.
    Did Microsoft has given any solution rather than you mentioned..
    thanks,
    Swapnil

    ReplyDelete
  2. Swapnil,
    I don't know about other suggestions from MS.

    ReplyDelete