Deploying Page Layouts Containing Default Web Parts

Have you ever come across the following? You are deploying page layouts containing default web parts, using features, and every time you activate the feature the page layouts get another set of default web parts. So when you create new pages based on these page layouts, they will get an increasing number of instances of each default web part. 

This is because the elementmanifest.xml file is re-applied to the page layouts, and default web parts are added once more, whether or not they already exist. Our solution to this problem is to have two elementmanifest.xml files, one with web parts, and one without. We then build two solution files using MSBuild, one for first time deployment and one for upgrade.

Skip to main content