Pages

Tuesday, July 12, 2016

[SOLVED] Missing server side dependencies - [MissingAssembly]

Maybe most of you had seen this Health Analyzer Rule error:
[MissingAssembly] Assembly [WebProvisionedEvent, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a505ed585a006cfc] is referenced in the database [WSS_Content_05], but is not installed on the current farm. Please install any feature/solution which contains this assembly. One or more assemblies are referenced in the database [WSS_Content_05], but are not installed on the current farm. Please install any feature or solution which contains these assemblies.


It happened to me after the farm solution has been redesigned and the new solution has been redeployed. If you search in Google for this error you will find a lot of suggestions how to fix it, but first of all you have to understand what exactly is causing this error and here I'll provide you my approach, afterwards you will be able to solve the issue without breaking your SharePoint 2013 farm. In my case it happened on SharePoint 2013 customer farm, but most probably the approach will work on SharePoint 2010.

First try to find what is inside the solution you deployed, simply unzip it with 7-Zip and look inside. Try to find which feature is related to this WebProvisionedEvent, in most of the cases EventReceiver is involved (as it was in my case). And because in the Content Database the path to the assembly was different (the one left from the old solution, before redesign). Thinking logically it make sens to reactivate the feature, so in the content database the path to the new .dll will be recorded. Sounds good and this should be the first step - reactivate the feature related to this EventReceiver. Some of the errors in the Health Analyzer will disappear, but not all of them. And this is normal because event receivers attached to the site, list or library are not removed when the feature is deactivated. And you need to remove them manually or with Power Shell.

I found the following script very helpful, but there is also a problem with the formatting and when you tried to import the script and use it you will get an error and maybe you can decide that the script is not working. What you need to do: Type the script manually in your text editor and save it as .ps1. Because as I already mentioned you try to copy and paste the script in your text editor or Power Shell ISE you may get an error due to a different formatting. It is  a bit long, but in order to work write the script manually in text editor.

OK, so after I manged to find out what was wrong with the code I was thinking YES finally I'll fix and get rid of this error in Health Analyzer. But unfortunately after I list which event receivers were left (using the "-ReportOnly" switch from the script) and deleted all of them afterwards, THE ERROR IN HEALTH ANALYZER WAS STILL THERE. And it was pointing to the same content database as it was from the begging.

After hours spending in troubleshooting and researching this error I was luckily able to find out that maybe the "old" event receivers exists in sites inside the recycle bin. I'm talking about Deleted Sites. And the aforementioned script is not removing the event receivers from sites which are inside the recycle bin (you can get a list of these sites with Get-SPDeletedSites). I was read somewhere in Google that if you remove these sites the entries in content database may left and then the only way to get rid of these event receivers is to manually remove them from content database.

So my approach was:
  1. Export the list of these deleted sites (Get-SPDeletedSite) 
  2. Restore them (Restore-SPDeletedSite) 
  3. Reactivate the "faulty" feature 
  4. Check if the issue is solved in Health Analyzer
  5. If not remove them with the script I already mentioned. 
For sure if you follow these steps the error will disappear afterwards. Then you can decide if you are going to Remove the sites you just restored or will left them as they are.

Let me know if try this approach, if it is working or not and share if you think it was helpful.

Link to the script uploaded in TechNet.

Happy SharePoint...ing :-)     

2 comments:

  1. UPDATE:
    Please keep in mind that if the site is "ReadOnly" you wont be able to delete the Event Receiver and you need to make the site read-write, delete the event receiver and make it again read-only.
    Don't forget to check "Get-SPDeletedSites", remove all the sites if they are not needed any more and really important - RUN "Gradual Site Delete" timer job, because it is scheduled to run once a day. Afterwards reanalyze the "Missing server side dependencies" Health Analyzer Rule and you should be "green".

    ReplyDelete
  2. UPDATE 2:
    If you are not getting any output from "Delete-MissingAssembly –ReportOnly" cmdlet, check if your Content DB is not in a OFFLINE mode! It is you are not getting any output! Make it Online, execute the cmdlet and put it back to Offline.

    ReplyDelete