Upgrading or Redeploying SharePoint 2010 Workflows
While creating several State Machine SharePoint 2010 workflows using visual studio for a client I had some concerns related to upgrading and redeploying those workflows because as we all know, changes are inevitable!
Where following are the concerns and my solution to them
1- How can we redeploy or upgrade workflow?
I found a nice article which goes in details of upgrading workflow approaches, and as per my analysis Versioning workflows seems to be the only feasible solution.
2- When it’s required to version my workflows and how can I minimized it?
Versioning is required only when UI changes are done on workflow e.g. modification in state, activities etc. as this will break running instance of workflows due to failure in deserialization.
As a strategy we chose multi-layer architecture, which means whole logic in a separate Class library (business) and workflows in separate Library where workflow only defines flow as shown below.

This means for code level changes or bug fixes, we only redeploy business solution wsp not affecting workflows wsp.
3- How to Version Workflow solution and any step by step instructions?
While goggling I could not found comprehensive step by step instructions.
Where following contain the step by step instruction how I implemented it.
Step 1: Upgrade Assemble
· Go to Workflow Solution -> AssemblyInfo Class and update assembly version and file version as shown below.

Step 2: Upgrade Workflow Element.xml
Go to modified workflows and Open their Element.xml files then
· Update 'CodeBesideAssembly' attribute assembly version.
· Update ‘Name’ with Version number at end e.g. xyz version 1.0.0.1 (for your convenience).
· Update 'ID' attribute with a new GUID (Tools->Create GUID).

Step 3: Workflow Feature Update
· Remove any existing feature that deploy workflows from solution
· Add a new Site Scope Feature with 'Name' e.g. PrjectNameWorkflowsVersionX.X.X.X
· Add only modified Workflows inside this feature (Step 2 modified ones only)
Step 4: Upgrade Solution Package
Double Click Package and then
· Update the 'SolutionId' with a new GUID.
· Update 'Name' with modified version.
Step 5: Deployment
· Build and deploy the new workflow wsp solution and IIS Reset.
Note: this will register a new version of the workflow assembly in the GAC.
Step 6: Association and No New instance
· Associate newly deployed workflow e.g. xyz version 1.0.0.1
· Go to Associated list Workflow Settings -> Remove workflow and Put the old version workflows as "No New instance".

Note: As my solution contains several workflows so I created a utility for Programmatically performing step 6 operation, here are some methods that I created that might be helpful.
''' <summary>
''' To Programmatically associate workflow with a List or library
''' </summary>
Public Shared Sub AssociateWorkflow(ByVal web As SPWeb, _
ByVal WorkflowGUID As String, _
ByVal WorkflowName As String, _
ByVal ListName As String, _
ByVal TaskListName As String, _
ByVal HistoryListName As String, _
ByVal AllowManual As Boolean, _
ByVal AutoStartChange As Boolean, _
ByVal AutoStartCreate As Boolean)
'Bind to lists.
Dim ListToAssociate As SPList = web.Lists(ListName)
Dim TasksListToAssociate As SPList = web.Lists(TaskListName)
Dim workflowHistoryList As SPList = web.Lists(HistoryListName)
'Get workflow Template
Dim workflowTemplate As SPWorkflowTemplate = web.WorkflowTemplates(New Guid(WorkflowGUID))
If ListToAssociate.WorkflowAssociations.Count > 0 Then
Throw New Exception(String.Format("List '{0}' is already associated with Workflow '{1}', Please Disassociate this workflow first.", ListToAssociate.Title, ListToAssociate.WorkflowAssociations(0).Name))
End If
'Create workflow association.
Dim workflowAssociation As SPWorkflowAssociation = SPWorkflowAssociation.CreateListAssociation(workflowTemplate, WorkflowName, TasksListToAssociate, workflowHistoryList)
'Set workflow options.
workflowAssociation.AllowManual = AllowManual
workflowAssociation.AutoStartChange = AutoStartChange
workflowAssociation.AutoStartCreate = AutoStartCreate
' Hint: WorkflowAssociation.Enabled = false means 'No new instantace'
'Add workflow association.
ListToAssociate.WorkflowAssociations.Add(workflowAssociation)
End Sub
''' <summary>
''' To programmatically start workflow already associated with a List or library
''' </summary>
Public Shared Sub ManuallyStartWorkflow(ByVal objWeb As SPWeb, ByVal listTitle As String, ByVal itemID As Integer)
Using elevatedSite = New SPSite(objWeb.Url, SiteHelper.GetSystemUserSecruityToken(objWeb))
Using web = elevatedSite.OpenWeb()
web.AllowUnsafeUpdates = True
Dim elevatedList As SPList = web.Lists(listTitle)
'Get Associated Workflow
Dim item As SPListItem = elevatedList.GetItemById(itemID)
If item.Workflows.Count = 0 Then
Dim myAssociation As SPWorkflowAssociation = GetWorkflowAssociation(elevatedList.WorkflowAssociations)
elevatedSite.WorkflowManager.StartWorkflow(item, myAssociation, myAssociation.AssociationData)
End If
End If
web.AllowUnsafeUpdates = False
End Using
End Using
End Sub
Where even after reading this article you don’t like any of the solution and you want to develop few workflows that are not complex, then go with Event Receivers you can build your logic by code resulting in better performance and you don’t have to worry about versioning or anything J
Upgrading or Redeploying SharePoint 2010 Workflows的更多相关文章
- Upgrade from SharePoint 2010 to SharePoint 2016
[转]http://nikcharlebois.com/upgrade-from-sharepoint-2010-to-sharepoint-2016/ In this blog, I will go ...
- SharePoint 2010升级到sharePoint 2013后,人员失去对网站的权限的原因及解决方法。The reason and solution for permission lost after the upgrading
昨天碰到了一个问题,一个网站在从SharePoint 2010升级到SharePoint 2013后,人员都不能登录了,必须重加赋权,人员才能登录,这样非常麻烦. 原因:是认证方式的问题.在Share ...
- 使用SharePoint 2010 母版页
SharePoint 2010母版页所用的还是ASP.NET 2.0中的技术.通过该功能,实现了页面框架布局与实际内容的分离.虽然在本质上自定义母版页的过程和以前版本的SharePoint大致相同,但 ...
- [SharePoint 2010]Sandboxed Solution (沙箱解決方案)
現有的SharePoint 2007系統中,我們如果要安裝客製化的程式碼到系統中,我們必須製作一個解決方案包裝檔(Solution Package),然後在系統的中央管理後台中,真對整個伺服器農場Fa ...
- SharePoint 2010 将带有工作流的模板移动到另一个站点集
HOWTO Move or Migrate SharePoint 2010 List-based Workflows between Sites and Site Collections I’ve e ...
- 在SharePoint 2010中,如何找回丢失的服务账号(Service Account)密码
背景信息: 通常在SharePoint环境中我们会使用很多的服务账号来运行各种不同的服务,尤其在企业环境中,由于权限管理条例严格,这些服务账号更是只能多不能少.面对如此多的服务账号,各个企业都会有自己 ...
- 安装InfoPath 2013后 SharePoint 2010 出现 “找不到 Microsoft.Office.InfoPath, Version=14.0.0....” 的错误的解决方案
1. 症状 您的SharePoint 2010的服务器是不是最近一直出现这个错误呢? Could not load file or assembly 'Microsoft.Office.InfoPat ...
- [SharePoint 2010] 自定义字段类型开发(二)
在SharePoint 2010中实现View Action Button效果. http://www.sharepointblogs.be/blogs/vandest/archive/2008/06 ...
- SharePoint 2010 + 左侧导航(Left Nav Bar)二级菜单的修改
SharePoint 2010 + 修改左侧导航类似顶部导航菜单的样式 查找aspmenu的控件,ID为“V4QuickLaunchMenu”,修改分别将属性“StaticDisplayLevels” ...
随机推荐
- 使用windbg分析iis崩溃的一个实例
问题背景说明:客户的生产环境不定时发生崩溃,需要定位崩溃的原因.在开发环境不能重现该问题,准备抓取IIS的dump文件分析 第一步:在客户的生产环境抓取dump文件 参考:IIS崩溃时自动抓取Dump ...
- LeetCode-304. Range Sum Query 2D - Immutable
Description: Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by ...
- nodejs morgan包
新建app.js var express = require('express') var logger = require('morgan') var app = express() app.use ...
- java基础---->java中正则表达式二
跟正则表达式相关的类有:Pattern.Matcher和String.今天我们就开始Java中正则表达式的学习. Pattern和Matcher的理解 一.正则表达式的使用方法 一般推荐使用的方式如下 ...
- Android 学习笔记多媒体技术之 Drawable类+Tween(补间动画)+Frame(帧动画)
学习内容: 1.了解Drawable类的作用 2.如何使用Drawable... 3.了解Tween动画... 4.如何创建和使用Tween动画... 1.Drawable类... Drawabl ...
- php中mysql操作的buffer知识
php与mysql的连接有三种方式,mysql,mysqli,pdo.不管使用哪种方式进行连接,都有使用buffer和不使用buffer的区别. 什么叫使用buffer和不使用buffer呢? 客户端 ...
- Android开发切换host应用
由于在工作过程中常需要切换手机的host来测试不同服务器上的接口,所以想到需要这么个软件. SwitchHost在PC上是一款很好用的修改Host的软件,手机上也需要这么一款App(当然手机需要已经R ...
- Weblogic魔法堂:AdminServer.lok被锁导致启动、关闭域失败
一.判断AdminServer.lok被其进程锁死 >weblogic.management.ManagementException: Unable to obtain lock on **** ...
- LeetCode - 30. Substring with Concatenation of All Words
30. Substring with Concatenation of All Words Problem's Link --------------------------------------- ...
- 重构第20天 提取子类(Extact SubClass)
理解:提取子类就是把基类中,不是所有子类或者只有少数子类用到的方法,提取出来,调整到子类中去. 详解:下面的代码中我们用到一个单一的类Registration,来处理学生选课信息. public cl ...