简体   繁体   中英

Sharepoint 2010 masterpage

I am creating a custom master page through feature in sharepoint 2010 visual studio and on deploying the feature I am getting this

Error occurred in deployment step 'Activate Features': Failed to instantiate file "custom.master" from module "CustomMaster": Source path "Features\\WSPBuilderImportProject2_SiteElements2db64791-54f6-4571-a161-66e0ef6497f5\\custom.master" not found.

RHM, your final url is doubled up. effectively you're trying to publish to _catalogs/masterpage/_catalogs/masterpage. try to only specify the list url in the module element and then put the remainder in without the path. Ie

I was having this same problem and having checked and double checked all my paths, urls etc were correct the master was just not being provisioned by the feature.

It turned out the VS2010 had got a little confused and messed up the path in the spdata file. If you're in the same situation definitely worth checking.

This is a fairly self explained error. SharePoint is not able to find the file in the location you have specified in Elements.xml . Check the location if it exists and retry.

If you deploy the masterpage as part as an feature (SharePoint solution) with for example Visual Studio 2010, the MasterPage will be deployed to the features directory. The feature file will provision the masterpage to the MasterPage Gallery (_Catalogs). As long as the file is not customized by SharePoint Designer, sharepoint will serve the masterpage (by using the virtual path provider) from the filesystem and not from the database.

<File Path="MasterPageModule\abc.master" Url="_catalogs/masterpage/abc.master" Type="GhostableInLibrary"  />

Deploy the master page. You can now control the master page by changing it from its physical location (SharePoint Root - 14 folder) and still be able to access from /_catalogs/masterpage/abc.master

The above is the recommended approach when you deploy master pages and page layouts.

My module folder has master page in it with name of "custom.master" and here is the xml

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Url="_catalogs/masterpage" RootWebOnly="FALSE" Name="CustomMaster">
    <File Type="GhostableInLibrary" Url="_catalogs/masterpage/custom.master" Path="CustomMaster\custom.master"  />
  </Module>
</Elements>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM