Sharepoint 为新网站集应用自定义母版页

Sharepoint 为新网站集应用自定义母版页,sharepoint,master-pages,sitecollection,spsite,Sharepoint,Master Pages,Sitecollection,Spsite,这适用于现有网站集及其下的任何新网站及其子网站,但当我创建新网站集时,我现在甚至无法创建新网站集,因为它会给我文件未找到错误,因为我的新网站集的根网站无法找到母版页…为什么??我是说怎么做 using (SPWeb currentWeb = (SPWeb)properties.Feature.Parent) { using (SPSite currentSite = currentWeb.Site) {

这适用于现有网站集及其下的任何新网站及其子网站,但当我创建新网站集时,我现在甚至无法创建新网站集,因为它会给我文件未找到错误,因为我的新网站集的根网站无法找到母版页…为什么??我是说怎么做

using (SPWeb currentWeb = (SPWeb)properties.Feature.Parent)
            {
                using (SPSite currentSite = currentWeb.Site)
                {
                   //Set Masterpage
                    Uri masterURI = new Uri(currentSite.Url + "/_catalogs/masterpage/V4Copy.master");
                    currentWeb.CustomMasterUrl = masterURI.AbsolutePath;
                    currentWeb.MasterUrl = masterURI.AbsolutePath;
                    currentWeb.Update();
                }
            }

在尝试链接到新网站集中之前,是否在其中创建母版页文件?