views:

397

answers:

2

We have webparts that use dll's which are in the GAC.

In the *.webpart file the dll is refered to in the type name tag. Here it is spesified with the version number.

Is it possible to get the web part to use a different version of the dll, without having to redeploy the webpart?

We have many pages that use the webpart. If we were to redeploy the webpart would we need to update all pages that used the webpart?

A: 

You can tryout assembly binding in the web.config file

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.SharePoint" publicKeyToken="71e9bce111e9429c" culture="neutral" />
    <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
  </dependentAssembly>
Kusek
+1. this will work.
Mike Chaliy
+2  A: 

This question is very similar

SO - SharePoint features: How can I use wildcard assembly versioning?

Whilst you can use a Publisher Policy file to redirect assembly versions this is a bit of a pain to administer.

Perhaps a better way is to reserve this for major version (e.g. SharePoint v11 to v12 or .net core libraries) and for minor versions (e.g. service packs etc) use the same AssemblyVersion but a different file Version. This is exactly what Microsoft themselves use and recommend.

KB556041 - How to use Assembly Version and Assembly File Version

Suppose you are building a framework assembly for your project which is used by lot of developers while building the application assemblies. If you release new version of assembly very frequently ... and if assemblies are strong named, Developers will have to change the reference every time you release new assembly ... A better option in such closed group and volatile scenarios would be to fix the 'Assembly Version' and change only the 'Assembly File Version'.

Ryan