views:

191

answers:

3

Has any one tried to version WSP in SharePoint 2010?

Thanks,

A: 

WSP don't really version.
You can however version components into it:

  • Feature or WebParts via different names (FeatureV1, FeatureV2...)
  • Assembly using standard assembly versioning (WebpartV1 use assembly 1.0.0, WebPartV2 use 1.1.0 and so on)
  • ...
Nico
You should be aware that if you change the assembly version (not the assembly file version) you won't be able to simply replace a web part assembly, you will have to remove it from all sites and add it again. If you let the assembly version untouched and just change change the assembly file version you can avoid this problem.
Flo
Just to clarify Flo's comments hes not talking about add/remove using STSADM its removing then adding and setting up a web part on each individual web part page its been used on - a real pain! You can use AssemblyBindingRedirect but thats not the recomended approach either.
Ryan
A: 

It would help to be a bit more specific that ".wsp" in your question.

As Flo mentioned - if you keep the assembly version the same but change the AssemblyFileVersion then you can upgrade the assemblies in your WSP solution using

STSADM -o upgradesolution ...

See my answer on SO - How can I use wildcard assembly versioning?

This will suffice for webparts but if you've got other artifacts and are using things like Feature things like event receivers then you may have to retract and re-deploy.

Ryan
A: 

Hi,

Thanks all for your replies. I have two concerns:

a. Assume my wsp is deploying a webpart with assembly version as 1.0.0.0 and assembly file version is also 1.0.0.0. Now after few days i need to deploy a recent version of webpart. The assembly version now will be 2.0.0.0 and assembly file version will also be 2.0.0.0. I have noticed that even if i retract and redeploy the wsp, the .webpart files that sits in the web part gallery always shows assembly version as 1.0.0.0. I guess this is because wsp retraction will not delete the .webpart file and neither feature deactivation. So the only option that remains is to write feature deactivation code to delete the .webpart file from webpart gallery. This will be largely in efficient as i will need to iterate through all the site collections of deployed webapplication to determine from the code ( a windows form as installer) the site collection where feature is activated and deactivate the same.

b. I need to query the webpart dll version for some operation. I was thinking it will be good if we can version wsp and keep the wsp version same as the web part dll. This will help me to remain in the SharePoint context to determine the web part dll version ( rather than querying the dll to find the version).

Thanks

Faiz
re: a) See my answer and specifically the "How can I use wildcard assembly versioning" link, it has everything you need. You shouldn't be changing Assembly version for minor version changes (just as, for example *ALL* SharePoint 2007 versions services packs/cum updates etc are 12.0.0.0) you use FileVersion for this - then no mucking around with deactivation etc. needed.
Ryan
Also you may want to read the FAQ (top right) for StackOverflow - its not a discussion forum and your clarification would be better edited in to your question.
Ryan