SharePoint Workflow feature in VS 2008


As mentioned in earlier posts, I was one of the developers on the SharePoint Workflow feature in VS 2008. (shipped as one of the VSTO components – available in Professional SKU upwards)


The feature include a set of VS project templates, wizard, and VS project package that integrates creating, deploying, and debugging of SharePoint workflows into a streamlined, simplified experience.


Those who have used WSS SDK or MOSS SDK would realize that creating and debugging workflows in SharePoint is not an easy task. The main pillars of this feature were to significantly lower the learning curve for SharePoint workflow development, and make developers more productive. To achieve this, we knew that we had to optimize – what I like to call the code-build-debug cycle. That’s where you are bound to spend most of your time while developing workflows, and any improvements there would be of great value.


Before VS 2008, typical code-build-debug cycle would be:



  1. Write the code
  2. Build the workflow project.
  3. Copy the latest feature.xml and workflow.xml files to the FEATURE directory.
  4. Remove any existing copies of the workflow assembly from the GAC.
  5. Add the latest version of the workflow assembly to the GAC.
  6. Re-start IIS.
  7. Install the feature with SharePoint using stsadm.
  8. Activate the feature at a SharePoint site where you intend to perform the debugging.
  9. Launch the web browser and go to the list that you want to associate the workflow with.
  10. Associate the workflow with  the list.
  11. Attach the debugger to the correct IIS worker process. (W3WP)
  12. Manually start the workflow.
  13. Debug the workflow.

The steps in red are scriptable, and WSS and MOSS SDK include batch files to enable that. However, batch files are difficult to maintain (source control, hard coding etc.?), error-prone (when something fails – what do you do?), and slow (more on this in another post). Rest of the steps are manual, tedious, and time consuming.


Using VSTO SharePoint workflow project templates, your code-build-debug cycle will be so simple:



  1. Write the code.

  2. Press F5 (builds, deploys files, associates the workflow feature in SharePoint, attaches the debugger to the correct W3WP process, launches the browser).

  3. Manually start the workflow.

  4. Debug the workflow.

Imagine this being repeated every time you make a change to your workflow. This is how VS 2008 already gives you a great productivity edge – you just need to now focus on designing your solution.


Get your copy of VS 2008 and give the feature a try, and drop me a line about how you find the feature.

Comments (52)

  1. ScottF says:

    And how exactly do you deploy to WSS? It says i need Office server dlls which are in MOSS i assume.

    Can you point me at some guide as to how to develop a workflow for WSS and deploy it? Can you do a sharepoint workflow for WSS?

    Scott

  2. Nikhil says:

    It should all just work with WSS. There are a few caveats though – you will have to remove the feature receiver that is specified in the default template of feature.xml (Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver). Also you have to remove some of the references to MOSS specific assemblies (Microsoft.Office.Workflow.Tasks). As you will realize these are optional helpers to make MOSS deployment (especially for InfoPath) easier, removing them does not make a difference if you try to deploy on WSS

    Let me know if that works for you.

  3. ScottF says:

    yup thanks after 4 hrs of pain i actually removed those lines and it deployed correctly.

    my collegue however gets and access denied message on hers when she tried to deploy (the xml files copy ok and the gac install is ok)

    the frustration factor on this product is immense…

  4. ScottF,

    Thanks for your feedback. We are continuously working on improving the development experience. I hope as you get more familiar with the tool your experience will improve.

    Your colleague might have received access denied if she does not have permissions as a site administrator in SharePoint. It is important to be an administrator to deploy SharePoint workflows.

    -Nikhil

  5. Michael Zill says:

    Nikhil,

    I’m unable to figure out how the InfoPath forms fit into your deployment/debug scenario? How do I deploy them when debugging?

    Thanks

    Michael

  6. Michael,

    We have provisions to deploy InfoPath forms, resx files, or any other files that you might have along with your workflow. You have to reference them in the feature.xml with the <ElementFile/> tag eg:

    <ElementFile Location="InfoPathForm.xsn" />

    Once you make a reference to them we will copy the files on deploy alongside the feature.xml in the FEATURES directory.

    Hope this helps!

    -Nikhil

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

  8. Mike P says:

    any advice on the following issue?

    When I create a sharepoint seqential workflow in VS 2008, I get a dialog box that contains the following.

    "Object reference not set to an instance of an object."

    Then it doesn’t find my sharepoint installation, although I have admin access. Any ideas?

  9. Hi Mike

    This has a known issue and it should be fixed soon. This might happen in one of the following cases:

    1. Your SharePoint server (IIS/ SQL server) is not running.

    2. You are working against a 64-bit version of SharePoint.

    Please ensure all this is set correctly – and it should just work. If you still have issues, can you please explain your SharePoint configuration and exact repro steps ?

    -Nikhil

  10. Oisin Grehan says:

    I am being hit with scenario #2 – developing against 64bit sharepoint.

    I am under NDA as an MS MVP (powershell/server admin), so any progress/workarounds/QFEs, please drop me a note at oising at gmail dot com.

    Thanks

    – Oisin

  11. Hi Oisin,

    64-bit version of SharePoint server is not currently supported with VS 2008. If you have any feedback regarding this please feel free to file it through http://connect.microsoft.com/

    Thanks,

    Nikhil

  12. Oisin Grehan says:

    Thanks for the quick reply Nikhil.

    You say: "This has a known issue and it should be fixed soon."

    Has Microsoft’s position on this changed? The tone of your answer certainly has 🙁

  13. Francisco Fagas says:

    But we can deploy custom workflows template in x64 platform using stsadm?

  14. Yes, Francisco. That should still work.

  15. Hanif Parkar says:

    Hi,

    I developed workflows in 32 bit environment, they work fine, are not working at in 64 bit; i am not getting any error; the workflow just does not start at all; i am using visual studio 2005,

    Thanks.

  16. Hanif,

    Are you using Visual Studio Extensions for SharePoint (VSeWSS) for workflow development in VS2005? Please note that they do not have support for 64-bit installs of SharePoint.

    However, at runtime in SharePoint, the workflow should just work irrespective of bitness. Did you have a look at the WSS logs to see what might have gone wrong?

    -Nikhil

  17. Hanif Parkar says:

    Hi Nikhil,

    I did use VSeWSS; from where can I check the WSS logs; I tried to browse the 12LOGS logs; but did not find anything; the workflow feature was all ok;

    thanks,

  18. Hanif Parkar says:

    This is the only error being logged related to workflow

    ———————————————————————————

    04/01/2008 12:31:25.45* w3wp.exe (0x1264)                       0x1318 Windows SharePoint Services   General                       0 Medium   …stem.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at ASP._layouts_workflow_aspx.ProcessRequest(HttpConte…

    Regards,

    Hanif Parkar

  19. Hanif,

    It appears that the workflow.aspx in the layouts directory is having this error. I’m not sure why this would happen. If you have not already done so, please try to post it on the MSDN SharePoint workflow forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1207&SiteID=1.

    Hope this helps!

    -Nikhil

  20. Hanif Parkar says:

    Hi,

    I created another 64 bit development environment with sql server, domain controller and the sharepoint  (all 64 bit editions) on a single server, and installed visual studio 2008; now i cannot create sharepoint workflow because of some error (as replicated in below link)

    http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=325668

    Well, now I am going to try to create a workflow project on 32 bit sharepoint wiht visual studio 2008; and then later try to port the code the 64 bit sharepoint server.

    Regards,

    Hanif Parkar

  21. Hanif Parkar says:

    Hi Nikhil,

    I got the workflow working on the 64 bit (single server) machine by just copying the dll, workflow.xml and feature.xml files.  I wonder what could be the reason for it not working on my production server.  I have used a different master page, some different css styles as far as I remember, but what could be the reason for the workflow to not work there.

  22. Hanif,

    Yes, we do not have support for 64-bit machines – as the MSDN connect request says.

    It’s difficult to say why it was broken on the production server. Please feel free to post it on MSDN forums, since there is an active community there.

    -Nikhil

  23. Abdul says:

    I am developing workflow on 32 bit machine with Visual studio 2008, and i want to port it our production server 64 Bit (Farm) , any body can help what the steps?:-) thanks in advance  

  24. Vishwajit says:

    Hey Nikhil:

    Is the above mentioned feature available in VS 2008  – 90days

    trial that is currently available for download ?

    cause i dont know what VSTO and SKU stand for ..

    -Vishwajit

  25. Yes, the 90 day trial for Visual Studio Professional edition: http://msdn.microsoft.com/vs2008/products/cc268305.aspx should have it.

    -Nikhil

  26. ONO says:

    I’m developing a WF for WSS 3.0 in VS2008. I removed the references that are not present on my machine (including Feature.xml).

    The workflow is really simple and there’s nothing to fail inside it.

    During deployment i get an "Object reference not set to an instance of an object." error.

    Any idea why that is ?

  27. Couple of things to check for:

    1. WSS Single server install is locally running on your machine.

    2. Select the project node in the solution explorer and right click to change the workflow debug settings… Go through the wizard to ensure that you have all the deployment and debugging parameters set.

  28. Doug Ware says:

    I am having the object reference error on MOSS 2007 SP1 32 bit. I must say that even if I weren’t I’m saddened that the development team chose the same misguided approach that has severely retarded the use of all your SharePoint tools, most notably VSeWSS.

    You are not doing yourself or the community any favors by burying this stuff in the tool. Everything this is attempting (and failing) to do can and is done by people all the time using scripts and managed code.

    I hope it won’t take a few more years of overlapping CodePlex projects before someone sees the light and opens this stuff up.

  29. Hi Doug,

    I will need more information to understand why that error might be occurring. Is it possible that your SharePoint server is turned off?

    And thanks for your feedback – we’re always looking to make improvements on our SharePoint tooling. I’ll blog more about this in a few weeks.

    -Nikhil

  30. Doug Ware says:

    Hi Nikhil,

    It’s running and the association succeeds. Here are the contents of the output window. This is MOSS Enterprise SP1 32 sans the infrastructure update.

    Compile complete — 0 errors, 0 warnings

    SimpleTemplate -> C:Workflow BasicsSimpleTemplateBaseSimpleTemplatebinDebugSimpleTemplate.dll

    —— Deploy started: Project: SimpleTemplate, Configuration: Debug Any CPU ——

    Successfully installed this assembly into the global assembly cache: SimpleTemplate.dll.

    Successfully restarted Internet Information Services (IIS).

    Successfully copied workflow.xml to C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12TEMPLATEFEATURESSimpleTemplateworkflow.xml.

    Successfully copied feature.xml to C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12TEMPLATEFEATURESSimpleTemplatefeature.xml.

    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.

    Thanks for taking the time to reply. I hope I wasn’t to negative, but whil I am complaining about the overall approach. 🙂 The tool should create and use proper Web Solution Packages.

    I’m sure you are aware of this, but if not, the tools team could benefit from this sort of approach: http://blogs.msdn.com/astoriateam/archive/2007/07/20/transparency-in-the-design-process.aspx

    Thanks!

  31. Parvesh says:

    Hey Nikhil,

    I was previously developling workflows on VS2005, but now have installed the VS2008 Trial and was looking fwd to do some workflow coding in 2008.

    My trouble is that Studio 2008 does not let me pass beyond Initial workflow screen as i am working via remote sharepoint installation.

    Is ther any option to DISABLE DEBUGGING and then atleast 2008 let me code the workflow?

    Thanks

  32. scott dot not says:

    I’m getting this same thing:

    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.

    I’ve set the debug settngs correctly it is associated with a list.  The strange thing is everything works fine.  It deploys, it even runs in debug mode.

    Even stranger is that this has worked in the past just fine.  I addded some SPD workflows and i guess i broke something.  I’ve tried klling the SPD workflows, but nothing gets rid of this anoyonce.

    I’ll try create a new toplevel site, and change the workflow assocuation.

  33. Hi Parvesh,

    Unfortunately, we do not support our VS experience without SharePoint server being installed on the local machine because that is one of the primary benefits of using our tool. One workaround that I can think of is creating the project on a machine that has SharePoint and then copying over the project to your working machine.

    Thanks for your feedback though. It will help us in keeping this in mind for the next release.

    Thanks,

    Nikhil

  34. Larry Smith says:

    I find it really disappointing that 64-bit solution is not supported given 64-bit architecture has been available for ~ 5+ years. One would imagine that any enterprise solution would consider 64 bit ahead of 32 bit, especially if one plans to operate in a large organization.

  35. Walter says:

    I downloaded the help desk application that was part the 40 applications that microsoft offered.  

    Using VS2008 workflow project template has been  problem for me, for it doesn’t recognize the help desk site I created.  error:  "sharepoint site location entered ins not valid. The sharepoint site at http://mysite could not be found.  Verify that you have typed the URL correctly.  If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."

    Any ideas on how to fix this.  I can navigate to the site just fine.  But VS2008 won’t access the site.

    thanks for your help.

  36. Hi Walter,

    I hope you are trying to access a local SharePoint site. VS 2008 does not support remote SharePoint sites. Is http://mysite equivalent to http://localhost?

    Can you give more details on your machine setup? Are you using MOSS or WSS?

    Thanks,

    Nikhil

  37. Walter says:

    Hi Nikhil

    I apologize for the late response.  I was able to figure it out fine and i’m able to connect to the site.  I’m now in the mist of trying create a workflow for the site which i’m still in the learning process.  I would love to have a workflow that once a user submits a ticket it emails the appropriate team and have a escalation for the assignto field.  If it’s not assign to a technician by a certain time is shoots an email to the appropriate person on the team.

    This is pretty good learning curve for me.

    Thanks

    Water

  38. SharePoint Workflow feature in VS 2008 says:

    Hi Nikhil

    I have my workflow working fine on my development server and now i’m migrating my site to the test server.  I copied the feature.xml and workflow.xml file to the test server and also place my dlls in the assembly folder.  Problem is, my workflow will not run. Is there something else i’m missing. I restarted IIS but still no results. Do you have any suggestions?

    Thanks

    Walter

  39. Nerisha says:

    Hi there.

    Please can you give me the sample code used for the workflow feature.  I am new to this and do not fully understand how to do this.

    Thank you

  40. Zakir says:

    Can you please tell about how to create and choose deploy location of a visual studio workflow to sharepoint sub sites?

    My problem is that i have a default sharepoint site in my sharepoint server 80 port. On this location i have created a new web application and on this web application i created seven sub sites. now i can’t able to choose the sub sites url while i am trying to create a workflow.

    Any suggestions please let me know.

  41. pritish says:

    After installing VS2008 pro on the sharepoint 2007 64 bit win2k8 server, I create a new SharePoint Sequential Workflow project and get the aforementioned "Object reference not set to an instance of an object" dialog.  I’m hesitant to continue seeing that there is no note here of this being fixed on VS2008 yet – at least I don’t see an update mentioned here.  

    Any news on that front?  Or suggested next steps?

    tia, pritish.

  42. pritish says:

    A similar project creation failure occurs using Visual Studio 2010 Beta 1 on the 64 bit MOSS 2007 server too. In the case of the newer IDE however, there is no dialog box, rather the status bar on the bottom says

    Creating project ‘SharePointWorkflow1’… project creation failed.

    fear.

  43. Hi Pritish,

    We do not have support for 64-bit installs of the MOSS 2007 server in VS 2010 Beta 1.

    -Nikhil

  44. Ann says:

    Hi Nikhil,

    Just want a confirmation. If we have our dev env on 64 bit moss 2007,  I should create workflow using VS 2005 and not VS 2008? Kindly clarify.

  45. Nick says:

    Well you wont be doing it with vs2008, thats for sure

  46. Avadhoot says:

    Hi Nikhil,

    Thanks for the great informative website !!!

    My problem is that, I m not able to add custom list through coding in VS2008. When I try to run my code, it runs successfully, even content types are also getting deployed but not the custom list.

    Please help me. Thanks in advance….

  47. Avadhoot says:

    Hi Nikhil,

    Thanks for the great informative website !!!

    My problem is that, I m not able to deploy custom list through coding in VS2008. When I try to run my code, it runs successfully, even content types are also getting deployed but not the custom list.

    Please help me. Thanks in advance….

Skip to main content