locked
Not possible to update existing page layouts included in a feature RRS feed

  • Question

  •  Hi all,

    We are creating a publishing site and are planning on deploying our master pages and page layouts through features. We’ve created a feature with a content type, a master page and a page layout (aspx), installed it and activated it on a site collection. That worked fine.

    However, since we are doing changes/additions to the master page and page layout during the development phase, we want to reinstall the feature to deploy our changes. Any changes to the master page works fine to deploy just by reinstalling the feature with the –force parameter. However, we can’t get any changes to the aspx file to get through. We have tried to install / uninstall the feature and also activated/inactivated it. We have also done iisreset several times. Whatever we try to do, the page new updated layout doesn’t seem to be applied to the pages we already created.

    The strange thing is that when we create a new site collection and activate the reinstalled feature, the change is included! But we can’t get the site that was created before the reinstall to be updated with the new page layout.

    Does anyone have any clues on what might be happening here?  It must be possible to deploy and update existing page layouts through features, right?

    Thanks for your input,
    Chris
    Thursday, August 21, 2008 2:25 PM

Answers

  • Christoffer1,
    I had the same issue, and it took me about a month to figure out the solution. You can find a post about it here:
    http://www.beckybertram.com/oldblog/index.php?p=37&more=1&c=1&tb=1&pb=1

    Basically, I created my page layout in SharePoint Designer, and then copied and pasted it into Visual Studio. When I deployed the page, though, it was behaving like you've explained, like it was customized. I finally checked the page using the SharePoint API and it was indeed registering as customized. This totally baffeled me, because SharePoint thought that page had been customized, even though the feature had just been activated and it had been no where near SharePoint since I had activated the feature that deployed the files to the Site Collection Master Page Gallery.

    It turns out the culpurit was this: SharePoint Designer put these two tags in the Page Directive at the top of the page:
    meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document"
    when I originally created the page in SharePoint Deisgner. For whatever reason, when a Page Layout gets loaded and it sees these directives, it logs that page as being customized. So, when I copied my markup from SharePoint into the Page Layout in Visual Studio, it took these meta tags with it, and when I activated my feature, SharePoint said, "Aha, these pages have been in SharePoint Designer" (which they were, originally, just not since I had deployed the feature), "... they must have been modified!"

    I'm not sure if this is the issue you're having, but it certainly tripped me up for a while.

    http://blog.beckybertram.com
    Monday, September 1, 2008 6:21 AM

All replies

  • Christoffer1,
     
    Have you customized any of the pages via SharePoint Designer (SPD)?  If so, they are no longer read form the file system, they are read from the content database.  The same would apply to the master page of course, but it seems that that is being updated no problem.

    Can you provide the feature and any element files?

    Hope this helps.

    Dan
    http://devcow.com/blogs/jdattis/
    Thursday, August 21, 2008 6:17 PM
  • Hi Dan and thanks for your quick reply!

    None of the pages are customized in SPD. I'll attach the feature and elements xml below (examples from ACs chapter about feature deployment in WCM sites).

    Thanks,
    Christoffer


    <?xml version="1.0" encoding="utf-8"?>
    <Feature xmlns="http://schemas.microsoft.com/sharepoint/"
             Id="6B0480D2-009A-49c1-9DCB-EBF5F7358873"
             Title="Alternative Approach Feature"
             Description="Creates site columns, content types, a master page, and page layouts for a Publishing site."
             Scope="Site"
             Hidden="FALSE">
      <ElementManifests>
        <ElementManifest Location="SiteColumn.xml"/>
        <ElementManifest Location="ContentType.xml"/>
        <ElementManifest Location="ProvisionFiles.xml"/>
      </ElementManifests>
    </Feature>

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Field ID="{C3AA9C21-81F7-41d7-B5A5-CBEB40768C46}"
             Name="AlternateApproachColumn"
             DisplayName="Alternate Approach Column"
             StaticName="AlternateApproachColumn"
             Group="WROX"
             Type="Text" />
    </Elements>

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <ContentType ID="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900213FEEC23C37400bBEC425C10E76F37F"
                   Name="Alternate Approach Content Type"
                   Description="Content type derived from 'Page' content type."
                   Group="WROX">
        <FieldRefs>
          <FieldRef ID="{C3AA9C21-81F7-41d7-B5A5-CBEB40768C46}"
                    Name="AlternateApproachColumn" />
        </FieldRefs>
      </ContentType>
    </Elements>

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <!-- provision master page -->
      <Module Name="WROXMasterPages"
              Url="_catalogs/masterpage"
              Path=""
              RootWebOnly="TRUE">
        <File Url="ACminimal.master"
              Type="GhostableInLibrary">
          <Property Name="ContentType"
                    Value="$Resources:cmscore,contenttype_masterpage_name;" />
          <Property Name="PublishingPreviewImage"
                    Value="~SiteCollection/_catalogs/masterpage/Preview Images/wrox.jpg, ~SiteCollection/_catalogs/masterpagePreview Images/wrox.jpg" />
          <Property Name="Description"
                    Value="Provisioned from the AlternativeApproach Feature. "/>
        </File>
      </Module>

      <!-- provision page layout  -->
      <Module Name="WROXPageLayouts"
              Url="_catalogs/masterpage"
              Path=""
              RootWebOnly="TRUE">
        <File Url="AltApproachPageLayout.aspx"
              Type="GhostableInLibrary">
          <Property Name="ContentType"
                    Value="$Resources:cmscore,contenttype_pagelayout_name;"/>
    <Property Name="PublishingAssociatedContentType" Value=";#Alternate Approach Content Type;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900213FEEC23C37400bBEC425C10E76F37F;#"></Property>
          <Property Name="PublishingPreviewImage"
                    Value="~SiteCollection/_catalogs/masterpage/Preview Images/wrox.jpg, ~SiteCollection/_catalogs/masterpagePreview Images/wrox.jpg" />
          <Property Name="Description"
                    Value="Provisioned from the AlternativeApproach Feature"/>
        </File>
      </Module>

      <!-- provision preview image -->
      <Module Name="WROXPreviewImages"
              Url="_catalogs/masterpage"
              Path=""
              RootWebOnly="TRUE">
        <File Url="wrox.jpg"
              Name="Preview Images/wrox.jpg"
              Type="GhostableInLibrary"/>
      </Module>
    </Elements>

    Friday, August 22, 2008 7:28 AM
  • Can you make sure that the files are actually getting updated within your features folder? (Check the timestamp)
    Friday, August 22, 2008 12:58 PM
  • What types of changes are you trying to make with the page layouts? If you're doing something like adding default Web Parts, those won't take effect in existing pages using that page layout. Reason for this is that (Web Part) is simply personalization data that is prefilled when the page is created. From that point on, personlization data won't bleed through because that is not used in future request for the page... but it will show for new pages.
    -AC [MVP MOSS] :: http://www.andrewconnell.com/blog
    Saturday, August 23, 2008 2:01 AM
  • Hi all,

    Yes, the aspx page is indeed updated in the features folder. And the changes I'm making is in some HTML that surrounds some of the field controls.

    Are the aspx pages actually stored in the database after installing these as features?  Just wondering if this is the expected behaviour and why the same is not happening when making changes to masterpages in the features folder?

    Cheers,
    Chris
    Monday, August 25, 2008 12:46 PM
  • Let me answer you like this: Features provision instances of files into the SharePoint sites which involves putting it in the database. If the file remains unchanged (uncustomized), then the one off the filesystem is used. If it is customized (ala: changed with SharePoint Designer 2007), then the source is stored in the DB. Check out this white paper for a deeper discussion on it: http://msdn.microsoft.com/en-us/library/cc406685.aspx.

    What I'd suggest is making sure the page is uncustomized. The white paper I linked to shows you how to do this. That will tell you if the file is being pulled from the file system or database. You also might want to look into reactivating the Feature (via STSADM and using the -force argument for activatefeature operation).


    -AC [MVP Office SharePoint Server] <> http://www.andrewconnell.com/blog

    Monday, August 25, 2008 2:12 PM
  • I had the same problem.

    The layout cannot be modified because of WebParts on the layout. If you modified any of the pages, based on that layout, those pages will be saved on database and will not be updated after feature upgrade.

    From now on you have to change those pages by using SP Designer.
    Thursday, August 28, 2008 8:00 AM
  • SPD isn't the issue here... what you describe is classic customization with SPD which doesn't apply in this case.


    -AC [MVP Office SharePoint Server] <> http://www.andrewconnell.com/blog
    • Proposed as answer by Ben Robb Thursday, August 28, 2008 4:01 PM
    Thursday, August 28, 2008 11:56 AM
  • Friday, August 29, 2008 9:38 AM
  • Christoffer1,
    I had the same issue, and it took me about a month to figure out the solution. You can find a post about it here:
    http://www.beckybertram.com/oldblog/index.php?p=37&more=1&c=1&tb=1&pb=1

    Basically, I created my page layout in SharePoint Designer, and then copied and pasted it into Visual Studio. When I deployed the page, though, it was behaving like you've explained, like it was customized. I finally checked the page using the SharePoint API and it was indeed registering as customized. This totally baffeled me, because SharePoint thought that page had been customized, even though the feature had just been activated and it had been no where near SharePoint since I had activated the feature that deployed the files to the Site Collection Master Page Gallery.

    It turns out the culpurit was this: SharePoint Designer put these two tags in the Page Directive at the top of the page:
    meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document"
    when I originally created the page in SharePoint Deisgner. For whatever reason, when a Page Layout gets loaded and it sees these directives, it logs that page as being customized. So, when I copied my markup from SharePoint into the Page Layout in Visual Studio, it took these meta tags with it, and when I activated my feature, SharePoint said, "Aha, these pages have been in SharePoint Designer" (which they were, originally, just not since I had deployed the feature), "... they must have been modified!"

    I'm not sure if this is the issue you're having, but it certainly tripped me up for a while.

    http://blog.beckybertram.com
    Monday, September 1, 2008 6:21 AM
  • Thanks all for your help,

    Becky - my issue was the same as yours. Removing the attributes that SPD added solved the problem!

    Thanks a lot for your help! That saved a lot of time and hassle for us!

    /Chris
    Tuesday, September 2, 2008 7:39 AM
  • Becky, you're an angel.  I just spent 4 hours trying to figure out what the heck was going on.  I did exactly as you did..  create my page layouts in SPD and then deploy them via a feature in VS.  Removing those SPD tags fixed it quite nicely!

    Thank You!!
    Saturday, November 1, 2008 2:17 AM
  • Thanks!

    This helped a lot.

    Kind reg.
    Tor Sigve
    Monday, March 30, 2009 6:54 AM