While developing our intranet based on SharePoint 2010, I ran into the issue that Page Layouts I created were not updated when deployed.
We have a Visual Studio 2010 solution with several projects. One of the project contains the page layouts. This project is deployed to the SharePoint server. For creating these page layouts I use the SharePoint Designer 2010 (SPD). When done, I copy and paste the code to Visual Studio 2010.
After deployment I have created a page based on the custom page layout. The page just looked great and works like a charm! :p But I wanted to change the style a little bit so I had to add some class attributes to some DIV elements in the page layout. I did my copy and paste action again, build and deployed my project again. No errors here. However, I noticed my new style was not applied. Huh?
Time to ask internet… 🙂
I found this article by Becky Bertram.
Yep, that was my case, too. Now I know.
<%@ Page language=”C#”
Inherits=”Microsoft.SharePoint.Publishing.PublishingLayoutPage, Microsoft.SharePoint.Publishing, Version=18.104.22.168, Culture=neutral, PublicKeyToken=71e9bce111e9429c”
When creating page layouts with SPD, SPD adds some specific meta data. You should remove all these SPD metadata before copying the code to Visual Studio.
Also, when you add WebParts to your page layout (like I have), SPD will add the __WebPartId attribute with a GUID for its value. You should remove that also when copying the code to Visual Studio.