Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

Edit:

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"/>
    </File>
  </Module>
</Elements>

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)
                                      }).ToArray()
                         }).First();

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

Thanks in advance.

share|improve this question
add comment

marked as duplicate by Andrey Markeev, SPDoctor May 14 '12 at 12:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 0 down vote accepted

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

share|improve this answer
    
Possible duplicate –  Falak Mahmood May 14 '12 at 9:05
    
Hi Falak, I have it a go but didn't get it to work, updated my question. –  john May 15 '12 at 2:28
    
Set IgnoreIfAlreadyExist="True" and run the code again, and post you comments. –  Falak Mahmood May 15 '12 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 '12 at 1:22
add comment

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