今天在Visual Studio 2012中將頁面佈局打包到網站定義中。html
新建Module 「MasterPageGallary」佈局
在Element中以下:網站
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Module Name="MasterPageGallary" List="116" Url="_catalogs/masterpage" Path="MasterPageGallary" RootWebOnly="TRUE"> <File Path="EnterprisePortal.master" Url="EnterprisePortal.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="True" NavBarHome="False"> <Property Name="Title" Value="企業門戶母版頁" /> <Property Name="ContentTypeId" Value="0x010105" /> <Property Name="UIVersion" Value="15" /> </File> <File Path="EnterprisePortal_Welcome.aspx" Url="EnterprisePortal_Welcome.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="True" NavBarHome="False"> <Property Name="Title" Value="企業門戶歡迎頁" /> <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" /> <Property Name="PublishingAssociatedContentType" Value=";#$Resources:cmscore,contenttype_welcomepage_name;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4;#" /> </File> </Module> </Elements>
結果,部署後看似正常,可KenDie的微軟,竟然在頁面佈局這個頁面中添加一段html代碼,相似ui
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head> <META name="WebPartPageExpansion" content="full"> <!--[if gte mso 9]><xml> <mso:CustomDocumentProperties> <mso:PublishingPreviewImage msdt:dt="string"></mso:PublishingPreviewImage> <mso:ContentType msdt:dt="string">Page Layout</mso:ContentType> <mso:MasterPageDescription msdt:dt="string"></mso:MasterPageDescription> <mso:PublishingAssociatedVariations msdt:dt="string"> </mso:PublishingAssociatedVariations> <mso:PublishingHidden msdt:dt="string">0</mso:PublishingHidden> <mso:PublishingAssociatedContentType msdt:dt="string"> ;#Agenda item;#0x010100C568DB52D...;#</mso:PublishingAssociatedContentType> </mso:CustomDocumentProperties> </xml><![endif]--> <title>Dummy Content Type</title></head>
網上找了以下博客,終於解決這個問題。spa
http://blog.mastykarz.nl/placeholderpagetitle-is-the-root-of-all-evil/code
原文的意思是,頁面佈局頁面頂部,若是第一個Content的ContentPlaceholderID爲PlaceHolderPageTitle的話,那麼會自動在底部追加那段html。xml
這個什麼莫名其妙的Bug?不過能解決問題就好。htm