With SharePoint you can use a Feature Receiver to perform some actions when a feature is installed/uninstalled etc.
The feature receiver is ran from the OWSTIMER service and the process seems to be roughly
- .wsp (a cab file) is unpacked and examined
- .dll's are moved to bin/gac
- feature receivers marked in manifest are called (can only be in GAC) by the service
However OWSTIMER keeps a handle open on the dll containing the feature receiver.
This means that when you uninstall the feature Fusion will move the dll to the c:\windows\temp\ directory and still keep the reference. (More details here and here)
When you then try and install the new version (assembly file version different but assembly version has to remain the same) OWSTIMER will run the OLD feature receiver.
You can stop this occurring with a restart of the OWSTIMER service but this is not practical on a production farm environment where there may be many web servers.
Anyone know of any workarounds?
Do an iisreset between swapping over features.
Yes, brings down all the web apps but that's why you have planned outages / do it out of hours. And make sure the process is well rehearsed on your dev machines.