1

When I republish my MasterPage through Visual Studio 2012, I have an issue with the old master page not being able to be deleted.

I get a error message saying that a conflict could not be resolved, but the deployment indicates success anyway.

It seems the Master Page can't be deleted. I've even tried manually deleting through SharePoint Designer but it tells me that the page is referenced by other pages.

What works is the following:

  1. I move the page to a save directory after making another page the Master through "Site Settings"
  2. Through "Master page" under site setting--I deploy my new MasterPage. Then make it the Master Page through Site Settings.
  3. Only then am I able to delete the original page from the Save directory
  • AFAIK, since the Master Page is in use (current master page) it cannot be deleted which makes sense. However if you are willing to update Master Page and deploy it via WSP, you can use GhostableInLibrary=True attribute in your XML file so the Master Page becomes part of the Library/DLL of the project (you should not then manually update the file) – Arsalan Adam Khatri Nov 4 '14 at 15:49
  • @ArsalanAdamKhatri why not post this as answer? – Alexey Krasheninnikov Nov 4 '14 at 15:52
  • ^ Coz I'm not sure if this is correct answer :) – Arsalan Adam Khatri Nov 4 '14 at 15:52
  • @StephanOnisick and the question is? – Alexey Krasheninnikov Nov 4 '14 at 15:52
2

Here is a working example of the Elements.xml file:

<?xml version="1.0" encoding="utf-8"?>
  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="MasterPageModule" List="116" Url="_catalogs/masterpage">
      <File Path="MasterPageModule\Custom.master" Url="Custom.master" Type="GhostableInLibrary" ReplaceContent="TRUE"/>
    </Module>
  </Elements>

The important point is to use these two attributes:

Type="GhostableInLibrary" ReplaceContent="TRUE"   

SharePoint module should look something like this:

enter image description here

Also. I am not 100% sure, but if you've got CKSDev installed, you can update your master page right from Visual Studio without deploying it each time.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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