Problem: Could not load assembly reference

Sitefinity CMS ships with an updated reference to System.Web.OData. This updated reference has a chain of dependent references that get added when you use the NuGet package. When using Visual Studio versions 15.8.0 and above, Visual Studio automatically adds assembly binding redirect for the following assemblies:

  • System.Linq
  • System.Linq.Expressions
  • System.Reflection
  • System.Runtime.Extensions

It redirecting them to .NET Framework version 4.8.  Because Sitefinity CMS 13.2 and above is built with .NET Framework 4.8, on runtime you get the assembly reference error.

The exception occurs in the following format:
Could not load a reference assembly for execution

Solution: Fix the incorrectly introduced binding redirects

Remove the assembly binding redirects in your web.config for the following assemblies:

  • System.Linq
  • System.Linq.Expressions
  • System.Reflection
  • System.Runtime.Extensions

Save the web.config and run your project. 

Optional step: Delete the incorrectly added assemblies
Although they will no longer cause any issues, you can also manually delete the following assemblies, targeting .NET Framework version 4.8 from your Sitefinity CMS project bin folder:

  • System.Linq
  • System.Linq.Expressions
  • System.Reflection
  • System.Runtime.Extensions

If you rebuild your project, the assemblies will no longer be present in the bin folder. 

Solution:  Downgrade or upgrade your Visual Studio version 

Use Visual Studio versions prior to 15.8.0 or Visual Studio 2017 15.9

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?