Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I got the solution and I would like to share with you. I think its a bug in SharePoint 2010 which is not well documented.. or even not documented.</p> <p>Following scenario: We have already a deployed package with a custom masterpage. We are now in the situation where we need to rename or remove the masterpage from the package. We were performing a Update-SPSolution and the result is a 404 error for that specific sitecollection. When we analyse the logs or any other part we will get no errors, no information's for this bug, everything from the log seems to work fine.</p> <p>But that’s a lie. In that moment where we have performed the update the masterpage assigned to that specific site collection is gone and occurs a null exception during initialization, which gets not logged. The 404-Error is the result.</p> <p>I spend now a day for developing a fix. Before we proceed with the update we have to remove and to reference the solution with a different masterpage. This can be done by PowerShell. For example it could look like this:</p> <pre><code># Delte old custom masterpage $web = get-spweb http://development/mysite $lib =$web.GetFolder("_catalogs/masterpage") $file = $lib.Files["MyMaster.master"]; $file.Delete(); $web.Dispose(); # Revert Branding to SP Default $site = Get-SPSite http://development/mysite $site | Get-SPWeb -limit all | ForEach-Object { $_.MasterUrl = $_.ServerRelativeUrl + "/_catalogs/masterpage/v4.master";$_.Update() } $site.Dispose() </code></pre> <p>After we have removed the masterpage manually we can proceed with the solution update and everything will work fine. Hope this will help anyone who is in the same situation.</p> <p>Update: I recognize that sometimes powershell is not ably to delete the masterpage. This is because the masterpage is still in memory. Therefore we need to clean the GC. Therefore here the updated script:</p> <h1>Delte old custom masterpage</h1> <pre><code>[System.GC]::Collect() [System.GC]::WaitForPendingFinalizers() $web = get-spweb http://development/mysite $lib =$web.GetFolder("_catalogs/masterpage") $file = $lib.Files["MyMaster.master"]; $file.Delete(); $web.Dispose(); # Revert Branding to SP Default $site = Get-SPSite http://development/mysite $site | Get-SPWeb -limit all | ForEach-Object { $_.MasterUrl = $_.ServerRelativeUrl + "/_catalogs/masterpage/v4.master";$_.Update() } $site.Dispose() </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload