SharePoint 2013 Issue – Custom Web Part results in Could not load file or assembly after upgrade

Audience

Everyone

After an upgrade of a SharePoint 2010 content database to SharePoint 2013 you may get an error message “Could not load file or assembly ‘MyCustomWebPart, Version=1.0.0.0, Culture=neutral, Public Token=6912jju2191j213ggv10’ or one of its dependants. The system cannot find the file specified” when you try to access a page.

This is fairly common when upgrading but the solution is very hard to find.

image
Figure: Could not load file or assembly

You may not have access to the custom Web Part or it may only work in SharePoint.vLast.

Applies to

  • SharePoint 2013
  • SharePoint 2010

Findings

If you just take the SharePoint databases and restore them to the new environment you may not have, or even be able to migrate the custom web parts that have been added.

In this case the custom web part was created and compiled for SharePoint 2010 and we will not be recompiling it for SharePoint 2013 but we still need to get the site running now. There are two main ways to solve this problem:

  • Reset to Site Definitions – This will reset an individual page or the entire site to the out-of-the-box definition of the page.
  • Edit with SharePoint Designer – This is a much more invasive option, but if things have been edited with SharePoint Designer you may be left with no choice.

Always start with resetting to Site Definitions option as it is the easiest, least invasive and quickest option.

Solution #1 – Reset to Site Definitions

This is the solution of first resort. It will fix most small issues and minimises the impact and risk to all users. If you reset your site to the site dentitions all of the little customisations that have been made to pages will be reset to the defaults. So if customisations have been made through the UI this will work a dream.. there is however one problem first… how do we get into the admin.

image
Figure: To access the admin page use ?content=1

If you add “?content=1” to the end of the URL you will find the SharePoint “Web Part Page Maintenance” screen for that page. Here you will have access to the rest of the settings that you need. And it shows that the site works, just not that page that we had a problem with.

image
Figure: Getting to the Web Part Page Maintenance

We can then see the little cog (settings) button on the top right and we get access to Site Settings.

image
Figure: Finding Reset to site definition on Site Settings

Go to “Site Settings | Site Actions | Reset to site definition” to get access to the feature that we need to fix this issue.

image
Figure: Reset all pages in this site to site definition version

Once on the “Reset Page to Site Definition Version” page you should select the “Reset all pages in this site to site definition version” so that we don’t have to do it for every page. This is something that I have always done for upgraded sites as the definition that you are resetting to is the one from the new version (SharePoint 2013 in this case) and that will improve the look and feel of the pages.

Unfortunately in this case there have been customisations made to the “default.aspx” file using SharePoint Designer and we need SharePoint Designer to fix them.

Solution #2 – Edit with SharePoint Designer

SharePoint Designer is a free download from Microsoft and will let you edit each individual page. I would never recommend using SharePoint Designer to edit pages but sometimes its evil has already been instilled in the pages and we need to get rid of it.

image
Figure: Open SharePoint Designer and the Site that you need to edit

Once you open the site (use “Open Site | http://myshareppoint:81/”)

image
Figure: Switch to All Files to get access to the default pages

We need to find the ‘default.aspx’ file in this case and for that we need to access “All Files”.

image
Figure: Check Out to Edit

In order to edit files in SharePoint you need to check them out first. This prevents random tampering and makes you check the changes in deliberately before they are visible on the site.

image
Figure: Some of the code is Protected

Now that I have found the culprit I can edit the page to remove it… except that I cant. In SharePoint Designer 2013 all of the wrapper code for the page is protected and cant be edited. The yellow highlight around the text is the indication that it is in this protected mode. if you want to exit it you need to switch to scary evil mode first.

This is a good thing as it will help limit the scope of the changes that people make with this tool unless they know what they are doing.

image
Figure: Switch to Advanced Mode (Scary evil mode)

Once in Advanced mode you will be able to edit all of the protected sections. We need to delete the line that references the Assembly that we do not have in the new instance. Make sure that you search for the Tag Prefix (In this case “WpNs5”) to make sure that you are not leaving any orphaned controls. You would need to remove them as well.

Once you have made your changes you can save and remember to check in to see the changes.

In this case all of the Register tags with the TagPrefix of “WpNs*” needs to be removed and any associated controls removed.

This will fix any issues with the pages loading.

Upcoming Training Opportunities

These are the next five classes we have, and you can check out our full public schedule of classes.

Timezone:
Live Virtual PAL Evidence-Based Management Online on 19th June 2023
Virtual
19-20 Jun, 2023
09:00-13:00 BST
2 half-days
APS 19th June 2023
Virtual
19-22 Jun, 2023
09:00-13:00 EDT
4 half-days
Professional Scrum Product Owner Immersion (PSPO-I) online 3rd July 2023 over 8 weeks
Virtual
3 Jul-21 Jul, 2023
13:00-17:00 BST
8 weekly half-days
PSPO-A 10th July 2023
Virtual
10-13 Jul, 2023
09:00-13:00 BST
4 half-days

We can deliver any of our courses as private in-house training over Microsoft Teams & Mural. We also recommend training based on your accountabilities or role, you can go directly to recommended courses for Scrum MastersProduct OwnersDevelopers and Agile Leaders.

Create a conversation around this article

Share on Facebook
Share on Twitter
Share on Linkdin

Related Courses

No items found

Read more

Martin Hinshelwood nkdAgility.com
https://youtu.be/_fFs-0GL1CA Why do you encourage people to follow a certification path in their career journey? I would encourage you to follow a scrum certification path for the same reason that people go to university. The same reason that people do any course or certification. It gets you a foot in …
Martin Hinshelwood nkdAgility.com
https://youtu.be/QGXlCm_B5zA What will you learn on the PSM II course? There are two main things that most scrum masters will learn on the PSM II or Advanced Professional Scrum Master course. That they haven’t been working effectively as a scrum master to date. That they are there to empower and …
Martin Hinshelwood nkdAgility.com
In Scrum Events across the world, I hear repeated the phrase “that’s how agile works” when describing behaviours that are both unprofessional and the very opposite of an agile mindset. These behaviours will inhibit agility and are a result of a lack of understanding of the underlying principles. We need …
Martin Hinshelwood nkdAgility.com
https://youtu.be/klBiNFvxuy0 What is the most common Aha moment people have in a scrum course? It depends on the scrum course they are attending. The content presented in the Applying Professional Scrum (APS) course leads to very different epiphanies when compared to the content presented on an Advanced Professional Scrum Master …

OUR TEAM

We believe that every company deserves high quality software delivered on a regular cadence that meets its customers needs. Our goal is to help you reduce your cycle time, improve your time to market, and minimise any organisational friction in achieving your goals.

naked Agility Limited is a professional company that offers training, coaching, mentoring, and facilitation to help people and teams evolve, integrate, and continuously improve.

We recognise the positive impact that a happy AND motivated workforce, that has purpose, has on client experience. We help change mindsets towards a people-first culture where everyone encourages others to learn and grow. The resulting divergent thinking leads to many different ideas and opportunities for the success of the organisation.