2

We have a SharePoint 2010 solution developed in Visual Studio, which when deployed adds an assembly to the GAC (let's say MySolution.dll, version = 1.0.0.0).

We make some changes and redeploy the updated assembly (MySolution.dll, version = 1.1.0.0). All works well, but we are getting assembly binding errors in the event log:

Event manager error:Could not load file or assembly 'MySolution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=*' or one of its dependencies. The system cannot find the file specified.

The application also includes reuseable workflows created in SharePoint designer, and these are associated with content types that were originally defined in MySolution v1.0.0.0. One of the features in the solution was updated in the new version and the feature itself updated using Chris O'Brien's Feature Upgrade Kit.

We have added a binding redirect to the new version in the web.config file for the web application hosting the solution (and have done this on all servers in the farm), but the error is still being logged.

How do we ensure the latest version of the assembly is always used?

1 Answer 1

3

All the information in the .dwp (and .webpart) files including the assembly version is only a blueprint for which web part and corresponding properties to load when you select this web part from the WebPart gallary, SharePoints WebPartManager will then store these settings (possibly updated by user) in the content database. Each time the webpart page is loaded the information will be read from the content database.

So if you update the Assembly version all existing instances added to pages will try to load the old version and fail unless you've added bindingRedirects in web.config (see Web Part Versioning with assembly redirection) this is why most SharePoint developers update AssemblyFileVersion instead of AssemblyVersion

2
  • 1
    How to use AssemblyFileVersioning - stackoverflow.com/a/1035411/20198
    – Ryan
    Commented May 25, 2012 at 9:16
  • 1
    Instead of changing the AssemblyVersion attribute in AssemblyInfo.cs change AssemblyFileVersion, this will leave all the loading of your Assembly untouched but give you the option to look at the deployed version in the GAC. Commented May 25, 2012 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.