Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Custom HTML Master Page not updating when activating Feature via PowerShell

$
0
0

I created a WSP to deploy a HTML Master Page.  I later have code that will publish this Master Page to create a .master, but I stripped this out just to simplify things.  My issue is with the first step - getting the HTML Master Page file to update by activating the feature using PowerShell.  I don't understand why it's not working - I'm not even using this Master Page currently.  Plus, oddly the master page does update if I go into the UI and deactivate/activate my feature. 

I can easily reproduce this problem using the following steps:

1. Created a SharePoint Empty Project named SharePointProject1

2. Added a Module named Module1

3. Added a HTML Master Page called MyMaster.html and updated the elements.xml file for the Module1 with the following:
 <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Module1" Url="_catalogs/masterPage/Test">
    <File Path="Module1\MyMaster.html" Url="MyMaster.html" ReplaceContent="TRUE" Level="Published" Type="GhostableInLibrary">
      <Property Name="Title" Value="My Master Page" />
      <Property Name="MasterPageDescription" Value="My Master Page" />
      <Property Name="UIVersion" Value=";#15;#" />
      <Property Name="HtmlDesignAssociated" Value="TRUE" />
      <Property Name="ContentType" Value="Html Master Page" />
    </File>
  </Module>
</Elements>

4. Deployed the WSP and activated the Feature containing Module1

5. Updated the HTML Master Page

6. Re-deployed the WSP

7. Deactivated the feature and Reactivated the feature using PowerShell 
     => _catalogs/masterpage/test folder still has OLD file - Why??
    $deployFeatureId = "575ec423-1b20-404c-8b2c-d160426c53e7"
    Disable-SPFeature -Identity $deployFeatureId -Url http://sp2013local -confirm:$false
    Enable-SPFeature -Identity $deployFeatureId -Url http://sp2013local

8. Deactivated the feature and Reactivated the feature through UI
     => _catalogs/masterpage/test folder now has the correct file

I even added event receiver code to delete the HTML file on deactivation but that still didn't work.




Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>