Using BindingRedirects for Web Part Versions

Today I found out how easy it is to use BindingRedirect tags in SharePoint 2010 to have two different versions of a web part. Having this option is helpful in the event that you’ve updated a web part with a new version but sites are using the older version.

In SharePoint 2007 you had to use SPWebModification to update the web.config but in SharePoint 2010, all you have to do is add the tags to the solution manifest!

Once you’ve incremented the assembly version in the AssemblyInfo.cs, double-click on “Package” to get to the manifest and add the bindingRedirect tags and safeControl entry of the older version in the “Edit Options” section. It should look something similar to this:

manifest

Once you’ve deployed the solution, if you look in the web.config you can see that both versions are there and there is a bindingRedirect tag added in the <assemblyBinding> area:

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: