SharePoint Workflow feature in VS 2008 (Part II)

I will continue from my last post on authoring SharePoint workflows in VS 2008 by providing a walkthrough.

In order to work with SharePoint workflows in VS you will have to setup your development machine as follows:

1)    Install Windows Server 2003.
2)    Install Internet Information Services (IIS). (In Control Panel, Add/Remove Windows Components, Application Server, Details, Internet Information Services (IIS).)
3)    Install .NET Framework 2.0 and.NET Framework 3.0.
4)    Enable ASP.NET 2.0.5727 in IIS Manager.
5)    Install Microsoft Office SharePoint Server 2007 (MOSS). Make sure to run the configuration wizard. [Edit: May 29: WSS is not supported]
6)    Install Visual Studio 2008. Use the default installation, or make sure that Visual Studio Tools for Office is selected on the Custom installation page of the Setup wizard.

Some questions that come to mind -  Firstly, why only Windows Server 2003 (no Windows Xp)? Well MOSS/WSS can only be installed on a Windows Server machine. And secondly, why does MOSS/WSS need to be installed on the development machine? It's just required to do any (not just workflow) practical SharePoint development since you have to do an iisreset, access the GAC etc.

Is the above installation order important? Yes and no. If you install SharePoint before Visual Studio, your toolbox for Workflow development comes initialized with all SharePoint related activities. So it is a good idea to install in that order. If you do not do so - you will have to reset your toolbox (Right click on the toolbox and select 'Reset toolbox') once you start developing SharePoint workflows.

Project Creation - Select the 'SharePoint 2007 Sequential Workflow'

NewProjectWizard

New SharePoint Workflow wizard: A wizard shows up that allows you to specify the parameters for debugging - the name of the worklfow, the local SharePoint site (no support for remote SharePoint sites)  on which to deploy the workflows, the list to associate it with, the task and history list to work with. Also you can specify, how you intend to start your workflow on F5. 

Wizard1

Select the parameters for workflow association on F5:

wizard2

Wizard3

 

Workflow designer: On pressing 'Finish' in the wizard, the workflow designer shows up.

designer

Property Window: A few additions to note include a property window that allows you to view/change the selections you made in the wizard. The property window is visible when you have the project node selected in the Solution Explorer.

PropertyGrid

 

Breakpoint: You can go ahead an now put a breakpoint in the workflow activity in the designer, by right clicking the activity and selecting 'Insert breakpoint' from the context menu.

breakpoint

 

Press F5 now to start debugging  and you will notice the output window shows all the deployment details - Install the assembly to the GAC, restart IIS, copy workflow.xml, feature.xml, and any other resource files/InfoPath forms you may have, install and activate the workflow template as a feature in SharePoint, associate the workflow with the list you specified in the wizard.

OutputWindow

In the browser window that launches you will see the deployed workflow.

DeployedWorkflow

After you manually start the instance of the workflow, you will see the breakpoint being hit:

breakpointHit 

Btw. my technorati profile is getting started here: Technorati Profile.

Comments

  • Anonymous
    January 19, 2008
    PingBack from http://msdnrss.thecoderblogs.com/2008/01/19/sharepoint-workflow-feature-in-vs-2008-part-ii/

  • Anonymous
    January 20, 2008
    Wow !!

  • Anonymous
    January 20, 2008
    People have already started blogging about the workflow creation with VS 2008. Here are a couple of cool

  • Anonymous
    February 09, 2008
    Before VS 2008, typical code-build-debug cycle would be: Write the code Build the workflow project. Copy

  • Anonymous
    February 15, 2008
    So, I want to make a workflow, but the development machine (Or the machine that I do all the programming/development on) is my computer, which has Windows XP Pro and does not have sharepoint installed on it. Our intranet server does have Windows Server 2003 and Sharepoint, but it is just a blade in the (very cold) server room. Is it possible to create a workflow like you outline without working on the actual intranet server? I'd really like to be able to use my nice warm office, with my big computer monitors to do this.

  • Anonymous
    February 25, 2008
    andyd273, Use Remote Desktop.

  • Anonymous
    March 06, 2008
    The comment has been removed

  • Anonymous
    March 07, 2008
    Andy, From what it looks like, you do not have permissions on the SharePoint server to install a feature. Can you please check the SharePoint logs in %PROGRAMFILES%Common FilesMicrosoft Sharedweb server extensions12LOGS  for more details on the error. Also, ensure that you are a "Site Collection Administrator" in SharePoint. Let me know if this works for you. Thanks, Nikhil

  • Anonymous
    March 26, 2008
    So, either i need to purchase Windows 2003 Server license for all the developer machine, or i need to install VS2008 on the server and let my 3 developers to remote into the server just to do workflow ?? Are you really serious?

  • Anonymous
    March 29, 2008
    Unfortunately, we don't have a better answer than that - since SharePoint is not supported on Client OS. And doing remote development is ticky from a client OS (More on this over here: http://msdn2.microsoft.com/en-us/library/bb530302.aspx). I have noticed that a number of SharePoint  developers using Virtual PCs on a Client OS to do their development. I would recommend using that if you can. This is also a good guide to machine setup for SharePoint development: http://weblogs.asp.net/erobillard/archive/2007/02/23/build-a-sharepoint-development-machine.aspx. Hope this helps! -Nikhil

  • Anonymous
    March 30, 2008
    Will Visual Studio Tools for Office ever be available for download for Visual Studio 2008 Standard? I really want this functionality for a WSS 3.0 site to build workflows but it's only available for VS 2005 or VS 2008 Pro and later.

  • Anonymous
    March 30, 2008
    Joe, AFAIK these features are only going to be available in VS 2008 Pro and up. Thanks, Nikhil

  • Anonymous
    April 03, 2008
    The comment has been removed

  • Anonymous
    April 21, 2008
    well i want to use infopath form in my workflow but i don't know how to deploy it with VS2008,can u help me, thank u

  • Anonymous
    April 27, 2008
    Hi Basma, You can have a look at my post here: http://blogs.msdn.com/nikhil/archive/2008/01/22/infopath-forms-deployment-sharepoint-workflow-in-vs-2008.aspx -Nikhil

  • Anonymous
    May 07, 2008
    I've been working on a workflow for a few weeks now and I have to say that debugging a workflow with VS2008 is often very clunky/quirky.  Sometimes my breakpoints aren't hit.  Sometimes when the breakpoint is hit, the debugger will bring up an older workflow diagram - missing shapes that are in the project one I just deployed. Some exceptions occur but the debugger doesn't catch them - the workflow just ends and I'm left looking through the SharePoint trace logs trying to find out why. This is still better than with VS2005 - automated deployment of the feature and the ability to debug into the code (even if inconsistent)

  • Anonymous
    May 29, 2008
    I have a develpment server running wss 3.0 and vs 2008 pro and I have the following message when building a project from the sharepoint templates: ------ Build started: Project: SharePointWorkflow4, Configuration: Debug Any CPU ------ C:WINDOWSMicrosoft.NETFrameworkv3.5Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Office.Workflow.Tasks". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. C:WINDOWSMicrosoft.NETFrameworkv3.5Vbc.exe /noconfig /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Data,System.Diagnostics,System.Linq,System.Xml.Linq,System.ComponentModel,System.ComponentModel.Design,System.Workflow.ComponentModel.Compiler,System.Workflow.ComponentModel.Serialization,System.Workflow.ComponentModel,System.Workflow.ComponentModel.Design,System.Workflow.Activities,System.Workflow.Activities.Rules,System.Workflow.Runtime,System.Workflow.Runtime.Hosting,Microsoft.Office.Workflow.Utility,Microsoft.SharePoint,Microsoft.SharePoint.Workflow,Microsoft.SharePoint.WorkflowActions /optioncompare:Binary /optionexplicit+ /optionstrict- /optioninfer+ /rootnamespace:SharePointWorkflow4 /doc:objDebugSharePointWorkflow4.xml /define:"CONFIG="Debug",DEBUG=-1,TRACE=-1,PLATFORM="AnyCPU"" /reference:"C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPIMicrosoft.SharePoint.dll","C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPIMicrosoft.SharePoint.Search.dll","C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPIMicrosoft.SharePoint.WorkflowActions.dll","C:Program FilesReference AssembliesMicrosoftFrameworkv3.5System.Core.dll","C:Program FilesReference AssembliesMicrosoftFrameworkv3.5System.Data.DataSetExtensions.dll",C:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.Data.dll,C:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.dll,"C:Program FilesReference AssembliesMicrosoftFrameworkv3.0System.Workflow.Activities.dll","C:Program FilesReference AssembliesMicrosoftFrameworkv3.0System.Workflow.ComponentModel.dll","C:Program FilesReference AssembliesMicrosoftFrameworkv3.0System.Workflow.Runtime.dll",C:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.Xml.dll,"C:Program FilesReference AssembliesMicrosoftFrameworkv3.5System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /keyfile:key.snk /out:objDebugSharePointWorkflow4.dll /target:library "My ProjectAssemblyInfo.vb" Workflow1.vb Workflow1.designer.vb "My ProjectSettings.Designer.vb" "C:Documents and SettingsupdiksbLocal SettingsTemp_wp46f6r.vb" vbc : warning BC40057: Namespace or type specified in the project-level Imports 'Microsoft.Office.Workflow.Utility' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. SharePointWorkflow4 -> C:Documents and SettingsupdiksbMy DocumentsVisual Studio 2008ProjectsSharePointWorkflow4SharePointWorkflow4binDebugSharePointWorkflow4.dll Done building project "SharePointWorkflow4.vbproj". ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== Also if I try to deploy, I get the following error: Feature 'ed6f8fba-4bea-415c-ac31-ce5daa6cfa96' could not be installed because the loading of event receiver assembly "Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" failed: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)   at System.Reflection.Assembly.Load(String assemblyString)   at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject() I noticed that there are references to the Microsoft.Office.WHATEVER assemblies & namespace but that isn't installed on my server (isn't that only installed with the full version of Sharepoint server - not WSS?)

  • Anonymous
    June 03, 2008
    The comment has been removed

  • Anonymous
    June 05, 2008
    I am getting the same compilation/deployment issues as Sam (who posted above). My assumption is that Microsoft.Office.Workflow.Feature is actuall  installed with the MOSS SDK. So like Sam I don't have MOSS, just wss, so should I install the MOSS SDK? Will this work without MOSS?

  • Anonymous
    June 05, 2008
    On the post by Nikhil: Nikhil, you propose that every developer either install Windows 2003 server or remote desktop into the server. Have you noticed that in the first link in your post the official microsoft documentation states that the best practice way to develop is for developers to work on a non server OS like XP and then deploy to the server. And yet you say this is impossible......  Something does not add up here.


Unfortunately, we don't have a better answer than that - since SharePoint is not supported on Client OS. And doing remote development is ticky from a client OS (More on this over here: http://msdn2.microsoft.com/en-us/library/bb530302.aspx). I have noticed that a number of SharePoint  developers using Virtual PCs on a Client OS to do their development. I would recommend using that if you can. This is also a good guide to machine setup for SharePoint development: http://weblogs.asp.net/erobillard/archive/2007/02/23/build-a-sharepoint-development-machine.aspx. Hope this helps! -Nikhil


  • Anonymous
    June 08, 2008
    Hi PurpleKateToo, Sam, VS 2008 workflow integration is only supported on MOSS. To get it to work on WSS there is a workaround. Remove the reference to Microsoft.Office.Workflow.Tasks from project assembly references. This assembly is only available in the MOSS version of SharePoint and will not be resolved on a machine with WSS installed. Also, open the feature.xml in the project and remove the ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" and ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver. This feature receiver is required for MOSS related functionality (InfoPath forms) and should not affect your WSS workflow development. Hope this helps! -Nikhil

  • Anonymous
    June 08, 2008
    Johan, Which link are you talking about here? "Have you noticed that in the first link in your post the official microsoft documentation states that the best practice way to develop is for developers to work on a non server OS like XP and then deploy to the server." -Nikhil

  • Anonymous
    June 08, 2008
    Hi Nikhil, I have been tinkering over the weekend, and discovering that by doing just what you suggested, I have managed to create a working Sequential workflow. I am now trying to do the same with a State Machine workflow. Thanks for your help, its good to know that I don't need MOSS, which would be overkill for my organisation.

  • Kate
  • Anonymous
    June 20, 2008
    This is a great bost, but like almost every other post out there from various people, it's incomplete.  These walk-thrus are awesome, but they always just stop abruptly and never show a full, end-to-end instruction...so people like me are left to try to piece things together from all over.  Every blog on this topic shows a different way of doing the same thing.  No standards, no best practices, just smart people who are close enough to the product to figure out their own personal workarounds for things that are not officially documented anywhere.  Sorry, it's just so frustrating how MS has thrown a product on the market and provided little to no information on how to make it work.

  • Anonymous
    July 15, 2008
    As mentioned I installed the VS 2008 on the Win Server 2003 machine which already have MOSS 2007 installed. Now when I try to create the new project and give the URL on my site I get the error "SharePoint Server not installed. Please run the Microsoft Office SharePoint Server 2007 setup." Just to let you know that I have a MOSS setup scaled on 3 Servers, Application Server, Web Server and DB Server. And I have installed VS2008 on Application server. Please suggest the solution.

  • Anonymous
    July 15, 2008
    We do not support development on a farm topology. Please install MOSS with single server installs for it to work. Thanks, Nikhil

  • Anonymous
    July 16, 2008
    Oh ok, I absolutely didn't find this thing anywhere that vs2008 doesn't support the development on MOSS if it is scaled on farm topology. Thanks. here are few things i would require ur help on.

  • Can u direct me some link where I can get more information related to vs2008 can be used on farm tolopogy.
  • What is the alternate solution I have to do the development mostly workflows for MOSS 2007. Thanks again. -Vaibhav
  • Anonymous
    July 31, 2008
    I've seen several comments on running SharePoint on a server. There is actually a way to run SharePoint (and develop workflows) on a Vista PC. Not supported, but it works. I'm doing it and it works fine. See the link above. Thanks, Jesper

  • Anonymous
    August 07, 2008
    Hello, I didn't see this anywhere in the post.  I developed a workflow as stated above using VS 2008.  Once I get the workflow working correctly, how do I deploy it to my production environment?  Is there a built in way to change where it is deployed to?

  • Anonymous
    August 11, 2008
    HI, Why dont you provide complete details of creating  simple workflows using Visual studio 2008-- i mean to say a complete details like  using few tools to present a meaningful workflow or refer some links for the same

  • Anonymous
    September 25, 2008
    Hi Nikhil, I have a workflow, which debugs and deploys fine on my development environment. And after I deployed it on production it was fine till then. I wanted to debug some error which I could not see on my development. so I took my code to the production for debugging. But my workflow doesn't deploy at all. It gives me the following error: Successfully installed the workflow template to Microsoft Office SharePoint Server. Failed to associate this workflow template with a Microsoft Office SharePoint list. Object reference not set to an instance of an object. Failed to deploy the workflow template to Microsoft Office SharePoint Server. ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== ========== Deploy: 0 succeeded, 1 failed, 0 skipped ========== I am using an account which has site collection admin rights. Plus I have tried uninstalling-deactivating reinstalling-reactivating several times but to no avail. In fact then created a new workflow on production and tried deploying it. But it gives me the same error. Would be thankful to any help.

  • Anonymous
    September 26, 2008
    Here the problem might be that we store the data for a particular SharePoint install - the list to associate with etc. It seems like since you have moved the project across computers now the data is not relevant any more and you might have to run the workflow debug wizard again to populate fresh data. Right-click the project in the solution explore and select "Workflow debug settings.." run through the wizard. See if that helps. -Nikhil

  • Anonymous
    November 19, 2008
    Hey Nikhil,,Gr8 Start Up blog,, Can you please provide some reference to the design the State Machine workflows in VS2008,,I tried on my own but struck up at deploying them coz of issuesin the way i'm assigning the activity owner ,,correlation tokens and its Task properties Would reallya ppreciate if you can point to some gud reference material

  • Anonymous
    January 11, 2009
    hi nikhil,             I have similar issues as with PurpleKateToo. I am developing a custom workflow for WSS 3.0. with VS 2008. I removed the referenced assemblies and also the receiver assemblies and receiver class from feature.xml as u suggested.            Still my issue is not fixed. When i start the workflow it says., "FAILED TO START". Am bugging around it since two days.. plz help -Kedar

  • Anonymous
    January 12, 2009
    Hi Kedar, Have you checked the SharePoint logs at %Program files%Common FilesMicrosoft SharedWeb Server Extensions12LOGS. You should see why it is failing to start. -Nikhil

  • Anonymous
    January 12, 2009
    Hi,         I am preparing workflows but here not available the microsoft office and I am using MOSS 2007 standard edition, so how can I produced the form to the client system.  There is any chances to produce a form instead of IP form, Document form. Thanks and Regards Venkatesh

  • Anonymous
    January 13, 2009
    The comment has been removed

  • Anonymous
    January 14, 2009
    Unfortunately, remote development of SharePoint workflow solutions is not supported. The SharePoint Dlls are not distributed on their own and hence, you will not be able to download them from anywhere. Your best bet is to setup a VPC for SharePoint development with server and VS installed on it. There are a couple of reasons why remote deployment is not supported for workflows. Deployment of workflows requires an IIS application pool reset every time a new version of the worklfow is deployed. The shared server cannot be used anything for development then and that completely mitigates any benefits of going remote. Also, you would require admin rights on the shared server to deploy workflows. This is why we do not support working against a remote machine.

  • Anonymous
    January 18, 2009
    The comment has been removed

  • Anonymous
    January 19, 2009
    Nikhil, In addition to the questions I have asked, I am a bit inquisitive about the way custom workflows work in sharepoint designer without having to manually access the remote server for deployment. We don't need to install any assembly or reset ISS in the case deploying a workflow created using sharepoint designer. How is this achieved??!

  • Anonymous
    January 28, 2009
    Sorry for the late response. SharePoint designer workflows are declarative (XML based) and hence, require lesser permissions to deploy and work across a remote setup. They support ASP.NET based forums that can be used to accept data. You can find more details here: http://msdn.microsoft.com/en-us/library/ms414204.aspx

  • Anonymous
    January 25, 2010
    Hello! I'm very new to working with WF. Is there other option that I can develope WF without a server OS? I'm a contact developer, & I'm working with a client.  They out-sourced their IT to someone else.  Due to some company policy, they're not allow to let work on my development directly on any server(s) (inclucding VPC).  There's no other way I can make them to change their mind. So, this is what I'm thinking & not too sure if this will work for me. I'm thinking if I just install the free copy of SharePoint to my development PC (XP-Pro), then create a WF project from my XP-Pro pc, then deploy to my client or give their IT company a copy of the deployment.  Will this work?  please verify & provide the links to help me to make this happen. Thank you!

  • Anonymous
    March 19, 2010
    hi nikhil, another one with a deployment problem :) i developed 2 workflows with vs2008, packed into a solution and try to deploy to a wss. i removed the receiverassembly and receiverclass tags from the feature xmls and removed the reference to Microsoft.Office.Workflow.Tasks from the project. solution deployment was ok, no errors, i see the features available and can active them and attach them to lists. but when i try to run the workflows, sharepoint doesnt start them. i don't even have a error message, the workflow status column stays blank, there is no error message in 12/logs/, nothing. after trying your mentioned hints without success, i'm pretty clueless what to do. thanks in advance, chris

  • Anonymous
    April 05, 2010
    ok i get it. also remove the TaskListContentTypeId attribut from elements.xml to make it work in wss