Custom PageLayouts - Reset to SiteDefinition does not work
Recently I ran into an issue with a custom pagelayout i created as a feature in SharePoint 2010.
I added some WebPart Zones on the pagelayout and added WebParts to the zones manually. I'm fully aware that the best approach is to add webparts when pages are created instead of adding them to the pagelayout. However. The pagelayout was working just fine - until a few weeks ago when the packages were updated. Normally this is not an issue either.
I found out that the PageLayout in /_catalogs/masterpage was NOT the same as the physical pagelayout file. And NO. The pagelayout is NOT customized. I tried to reset to sitedefinition on that pagelayout but that did not do the trick. To me it seems like sharepoint caches the WebPart zones for some reason. When browsing the pagelayout in /_catalogs i got my webparts more that once. At least three instances of the same WebPart. That did not quite match with the original file ;)
What i learn to discover was that when you are creating a new page based on that pagelayout, i uses the version from /_catalogs and not the one from filesystem even though the page is not customized. However, the file in /_catalogs had errors but the original pagelayout didn't.
1. Edit the pagelayout in VS. Create a copy of the file.
2. Remove ALL WebPartZones in the pagelayout file.
3. Deploy and activate the solution.
4. If you have a look now at the page layout in /_catalogs everything should be fine - which means NO webparts - no nothing. Just at simple pagelayout.
5. Go back to Visual Studio and copy the original code back to the pagelayout from the copy you made in step 1.
6. Deploy and activate. Voila! Your problems will dissapear - at least it did for me. Now the webparts ONLY shows up once and they do not fail.