Gotcha when working with master pages and page layouts in SharePoint Designer and Visual Studio

A common thing to do when editing master pages and page layouts in SharePoint is to edit them in SPD and then copy the source code to Visual Studio for check-in to source control. There is a gotcha here.

When SPD is used to edit a master page/page layout, it will insert the tag below into the <% Page %> directive:


This tag causes the page to be recognised as having been customised, i.e. unghosted. The problem is that when a page layout/master page is provisioned (via the Module feature element), and the file already exists at the targeted location, it will not be updated if it has been customised.

So by copying the source code as is (i.e. with the above tag) from SPD to VS and then build and deploy, our files will automatically be unghosted on deployment. This means that the next time you make a small update to the file and deploy again, the file will not be updated. This can be particularly annoying in dev cycles where you typically make big changes in SPD and minor tweaks in VS.

So, to avoid this, go ahead and copy the source code from SPD to VS, but be sure to remove the tag above from the code in VS.


About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in Branding, SharePoint 2010, SharePoint Designer. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s