使用模块将母版页部署到子站点
-
10-12-2019 - |
题
我创建了一个搜索中心,并想对其应用自定义母版页。我想使用模块和解决方案的功能来部署母版页。我创建了一个模块,Elements.xml 看起来像
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="SearchcenterModule" Url="Suche/_catalogs/masterpage">
<File Path="SearchcenterModule\minimal.master" Url="minimal.master" />
</Module>
</Elements>
在网站集功能中激活我的功能时出现错误
(null) 未找到“这样的”。
...
其中“Suche”是我的子网站的名称,即: http://mysharepoint/Suche
当然,我可以手动添加该文件,但必须有一种方法可以使用功能激活来部署它。
感谢您的帮助。
解决方案
我不知道解决方案,但是,您是否尝试将功能范围设置为Web,在Suche位上使用默认模块定义和激活此模块?
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MasterPageModule" Url="_catalogs/masterpage">
<File Url="MasterPage.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="False" />
</Module>
</Elements>
.
如果它不起作用,您是否尝试过〜网站令牌?
<Module Name="SearchcenterModule" Url="~Site/_catalogs/masterpage">
. 其他提示
母版页和页面布局只能部署到 SiteCollections,而不能部署到网站/子网站。
所以你的功能需要在站点范围内。您始终可以在您的FeatureReceiver中将母版页设置为特定的 SPWeb
.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="SearchcenterModule" Url="_catalogs/masterpage">
<File Url="minimal.master" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary" />
</Module>
</Elements>
IgnoreIfAlreadyExists
确保在部署时覆盖它,以便出现新的更改。 Type="GhostableInLibrary"
确保新的母版页/页面布局在母版页和页面布局库中可见。