Possible Duplicate:
How to update custom master page and page layout, which is already deployed

I have my custom masterpage in my visual studio solution and first time I deployed it worked fine. But since my masterpage now is used by all pages I can't simply update it and deploy again. If I have IgnoreIfAlreadyExist="False" then the deployment fails because it can't deleted it, if I have it set to True, well, nothing happens. I guess I could use a feature event receiver and set it to v4.master temporarily but I don't like that solution and how would you go about all page layouts? I don't want to have to upload them manually to the page layout gallery.

Thanks in advance.


My module file for masterpage looks like:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Masterpage" List="116" Url="_catalogs/masterpage" xmlns="http://schemas.microsoft.com/sharepoint/" RootWebOnly="True">
    <File Path="Masterpage\National.master" Url="National.master" Type="GhostableInLibrary">
      <Property Name="Title" Value="National.master"/>
      <Property Name="MasterPageDescription" Value="National.master"/>

But the code:

        Module module = (from m in xml.DescendantsAndSelf()
                         .Where(m => m.Attribute("Path") != null)
                         select new Module
                             ProvisioningUrl = m.Attribute("Url").Value,
                             PhysicalPath = Path.Combine(featureDir, m.Attribute("Path").Value),
                             Files = (from f in m.Elements(xmlns.GetName("File"))
                                      select new Module.File
                                          Name = f.Attribute("Url").Value,
                                          Properties = (from p in f.Elements(xmlns.GetName("Property"))
                                                        select p).ToDictionary(
                                                          n => n.Attribute("Name").Value,
                                                          v => v.Attribute("Value").Value)

Contains no file so the loop is not run after, am I missing something in my elements.xml file here?

Thanks in advance.


1 Answer 1


I have already wrote a solution sometime ago in the following thread: How to update custom master page and page layout, which is already deployed

  • Possible duplicate May 14, 2012 at 9:05
  • Hi Falak, I have it a go but didn't get it to work, updated my question.
    – john
    May 15, 2012 at 2:28
  • Set IgnoreIfAlreadyExist="True" and run the code again, and post you comments. May 15, 2012 at 7:16
  • Hi Falak, I added Path="Masterpage" to the module element and updated the file path to Path="\National.master" which solved the problem. Thanks
    – john
    May 16, 2012 at 1:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.