views:

598

answers:

3

I did a build of my SharePoint site template solution assembly and successfully deployed it to SharePoint, it was version 6.4.0.2032. I did some testing and found a couple problems with my code. I fixed the issues. Uninstalled my solution via "setup.bat /uninstall". Rebuilt my assembly to version 6.4.0.2033. I again installed my new template successfully, but when attempting to add one of my webparts to the page, SharePoint continues to look for the the old version of my assembly.

Am I missing a step?

Here is the snippet from the log in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS:

04/08/2009 13:04:58.18  w3wp.exe (0x0AA8)                        0x0BE4 Windows SharePoint Services    Web Parts                      8l4f Monitorable Error importing WebPart. Assembly  SharePoint.Site, Version=6.4.0.2032, Culture=neutral, PublicKeyToken=db45c0486d0dc06d, TypeName. SharePoint.Site.MetadataSearch, SharePoint.Site, Version=6.4.0.2032, Culture=neutral, PublicKeyToken=db45c0486d0dc06d
A: 

Which version is referenced ni your web.config file? Double check that it is the version you expect (6.4.0.2033). Do an IIsrest and try again.

Magnus Johansson
web.config is correct, IIS has been reset, and the server has been rebooted. Next?
Cube Pirate
+1  A: 

In SharePoint you have a lot of references to the assemblies. Some are stored in files on the disk (page references in the layout files) and others are stored in the content database (page references in content files). SharePoint also add SafeControls to the web.config file when you deploy using the solutions framework. These entries reference assemblies by their strong names.

My experience is that you should avoid changing assembly versions for SharePoint solutions - it will save you all kind of troubles. To keep track of the assembly versions, you should use the assembly file version instead. This will not cause errors with SharePoint.

Did I mention solution upgrades? Just think about upgrading an assembly in a farm where you web part has already been added to dozens of pages. All these pages would reference the old assembly and would probably cause unhandled errors after the upgrade.

The assembly file version property is set in the AssemblyInfo.cs file:

[assembly: AssemblyVersion("6.0.0.0")]
[assembly: AssemblyFileVersion("6.4.0.2033")]
Thomas Favrbo
+3  A: 

When a previous version is removed using "setup.bat /uninstall" I've noticed that the corresponding ".webpart" files for the WebParts do not get removed. When the new version is re-depolyed these ".webpart" files do not get updated and continue to point to the previous assembly version.

To see what assembly version your Web Parts are referencing:

  1. Open the top level site settings in SharePoint (Site Actions > Site Settings > Go to top level site settings)
  2. Click "Web Parts" under the "Galeries" column
  3. Click the "Edit" icon next to your Web Parts
  4. Click the "View XML" tool bar button

You should be able to find the corresponding new ".webpart" file (which should reference your new assembly) within your compiled solution. Then just upload it to this Web Part Gallery list (remember to check "overwrite the existing files")

If you can't find the ".webpart" file, you can always just download the copy from the "Web Part Gallery" and manually modify it.

Hope that helps.

Matt Donald