Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Can't deploy a masterpage as a feature, fails do to Type="GhostableI

  Date: Oct 13    Category: MOSS    Views: 1074

I hope someone here has had the same problem trying to deploy a custom
masterpage to a site collection. I have tried several ways, saving the site as a
site template, but when I create a new site from the template I get the old
masterpage.

I tried doing an export from sharepoint designer and an import to visual studio
2010 and I tried creating a feature module, both deploy, but when I have
Type="GhostableInLibrary" in the elements file I can't activate the feature, it
fails without any reason, when I take out Type="GhostableInLibrary" then the
feature deploys and activates, but it dosn't deploy the masterpage to the
masterpage gallery. I followed to the letter the instructions from msdn for both
of these:

msdn.microsoft.com/en-us/library/ff427543.aspx and using SPD with VS 2010
msdn.microsoft.com/en-us/library/ff506214.aspx

I am to the point that I will pay someone to help.

I am 100% sure that I have the module set up the right way, even if I didn't the
SPD export and import should work and doesn't.
Thanks all.

Share: 

 

8 Answers Found

 
Answer #1    Answered On: Oct 13    

If ghostableinlibrary fails then I suspect the address you are giving it is
incorrect and it thinks you are deploying to a folder not the masterpage
gallery. Can you post your module declaration here and I'll see if I spot
anything out of the ordinary. I've done this for most of my clients and it
works.

 
Answer #2    Answered On: Oct 13    

The only real difference is that I am trying to activate at the site collection
level and not the web level. Here is my code:

<Module Name="MyMasterPage" >
<File Path="MyMasterPage\_catalogs/masterpage\V4Custom_MasterPage.master"
Url="_catalogs/masterpage/V4Custom_MasterPage.master"
Type="GhostableInLibrary" />
</Module>

Just like that, I have also tried this one from the msft example, but it dosn't
work at all:

<Module Name="MyMasterPage" Url="_catalogs/masterpage">
<File Path="MyMasterPage\V4Custom_MasterPage.master"
Url="MyMasterPage.master" Type="GhostableInLibrary" />
</Module>

 
Answer #3    Answered On: Oct 13    

The Path statement in the File element would reference where the file is coming
from in your project feature. Normally that would be something like
“MyMasterpage\V4Custom_Masterpage.master”. The inclusion of the “/” in
that string is certainly wrong since the forward slash is illegal in a disk
path. Here’s an example of the Module I normally use:



<Module Name="CustomMaster" Url="_catalogs/masterpage">

<File Path="CustomMaster\NavArt.MySites.master" Url="NavArt.MySites.master"
Type="GhostableInLibrary" IgnoreIfAlreadyExists="true" >

<Property Name="UIVersion" Value="4" />

</File>

</Module>



The URL at the Module level points to the masterpage gallery of the site
collection. Then the URL at the file level can be just a filename. The path at
the file level points to the path of the master page within my project feature.
Please note that if the master page already exists in the gallery deploying the
solution won’t overwrite it (unless you are deploying from inside VS in which
case there is some extra code that deletes the file for you before deployment.)

 
Answer #4    Answered On: Oct 13    

So right now I have the masterpage in my VS project in the module like so:
MymasterPage\_catalogs\masterpage\V4Custom_Masterpage.master
I have the elements file in the root of the MyMasterPage module. If I understand
you below, you are saying to move the masterpage to the root of the folder where
the elements.xml file is, and use the code below?

 
Answer #5    Answered On: Oct 13    

Close, but not quite. Normally both the Elements file and the master page would
be in a folder in the root of your project called Mymasterpage. If you add a
Module item to your project you’ll see the folder structure I’m talking
about. By default the Elements.xml and the samplefile in the module will be in
a subdirectory together. So normally both the Elements file and the custom
master should be in a subdirectory called MyMasterpage. Then the code below
would be correct except the name of the module and the File path would contain
MyMasterpage in place of CustomMaster.

 
Answer #6    Answered On: Oct 13    

I had to build a somewhat round-about way to do this in 3.0. Ultimately
I had to add the masterpage.master to the master page gallery just like
adding a document to a document library. Then I set it as the default
and custom masters. The master page was a file in my WSP deployment. I
ignored doing it through Modules because I needed the ability to
deactivate the master page on feature deactivate and redeploy an updated
master page. Problem with Modules is I couldn't overwrite an existing
file through Modules. In 2010 I don't know what's different yet

 
Answer #7    Answered On: Oct 13    

I've normally done that in a module by writing both an activation and
deactivation event receiver for the Module Feature.

 
Answer #8    Answered On: Oct 13    

it really looks like I am doing it right, but it just won't go. I
have tried it on two different 2010 servers and nothing. Thanks for taking the
time though, I will just keep plugging at it.