Maintainability is important when you are developing custom software solutions. It is almost inevitable that there will be minor bugs or new feature requests from users that will require you to make changes to your custom software solution after it is deployed in production.
Upgrading custom SharePoint workflows can be quite time-consuming. The main reason why upgrading custom SharePoint workflows is difficult comes from the fact that each running workflow instance is serialized and de-serialized to and from the database many times during the lifetime of its execution. Any changes to the workflow's member variables will break SharePoint's ability to perform the serialization and deserialization on the running workflow instances. This means you can't simply make changes to the workflow assembly and overwrite the existing assembly in production unless the change is trivial enough that it will not affect the serialization/deserialization of the workflow.
Instead of upgrading a custom SharePoint workflow, the recommended approach is actually to create an entirely new workflow to replace the existing workflow. To handle the workflows that are in progress, leave the old version of the workflow in production and disable new instances of the old workflow from being instantiated.
Here are the steps to "upgrade" a custom SharePoint workflow:
- Change the workflow assembly's version number
- Update the workflow assembly version number in the attribute of the Workflow element in Workflow.xml file and the name attribute so that you can distinguish the new workflow from the old workflow
- Change the SolutionId in your manifest.xml file
- Change the name of the .wsp solution package (i.e. CorpSite.Workflow.ITRequest.wsp to CorpSite.Workflow.ITRequest.v1.1.wsp)
- Deploy the new .wsp solution package
- Run IISReset
- Configure the old version of the workflow to disallow new instances of it from being created by disabling all the start options in the old workflow association
- Create a new workflow association using the new workflow that was just deployed