Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

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

share|improve this answer
1  
How to use AssemblyFileVersioning - stackoverflow.com/a/1035411/20198 –  Ryan May 25 '12 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. –  Per Jakobsen May 25 '12 at 9:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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