Recently while working with Citrix WorkFlow Studio 2.0, starting to write some custom activities to help with data connections, I ran into a peculiar circumstance where Workfow Studio seemed like it was caching some old activities. Hmmmmm, Let dig a litle deeper!
Before we delve more into the guts of the article, lets provide a little background on WorkFlow studio and how we can extend it with our own code. If you want to see an brief unabridged of WorkFlow studio click the link below. You can also check out the Citrix site here
WorkFlow Studio Overview (Quick)
WorkFlow Studio is a tool for allowing IT Administrators the ability to automate certain processes without having to write much/any code. Some examples of this might be, auto provisioning user accounts in your directory service, creating or deleting XenServer VM’s based on space requirements, adding users to groups in active directory. WorkFlow studio is using Microsoft’s underlying Windows Workflow Technology, so if you are familiar with the MS WF Technology, then you should feel at home within this tool. Below is a screen of the WorkFlow Studio Designer with test workflow for creating a user.
Each one of the items listed in the above workflow are called activities . These are isolated bits of code that perform specific functions, say like creating a user. All the available activities that you can use in your own workflows are listed in the activities window as shown below.
The last thing I will touch on, is you can also build your own custom activities for use by other users of workflow studio. This is cool because if there is something lacking in the activities, you can just build it, and hopefully share it out to the community for other’s to benefit from. That is where this article came from.
On to the caching problem at hand!
The interesting thing about WorkFlow Studio (because its built on Windows Workflow Foundation) is that you can write your own activities and make them available for use in other activities and allow other users of WorkFlow Studio to use them as well.
So, developing your own custom activities is certainly an iterative process, write some prototype code, deploy it to the GAC (Global Assembly Cache), test the results. Rinse and repeat .
While doing this, I noticed a interesting thing happening. I would deploy my test activity to the GAC, then I would add it to workflow studio. All is peachy . Then i would remove it from the GAC, but it would still show up in workflow studio. This was puzzling me. WorkFlow Studio must be caching the information somewhere!
I dug around a little, but couldnt really pin point where this was happening, so I figured, go right to the source , so I shot an email over to Pete Shulz, Product Manager for WorkFlow Studio (you can follow him on twitter at @schulzpm to see if caching was indeed happening. Well, Pete did inform me that WorkFlow Studio does indeed cache previously added components. He also pointed me to this articles up on the Citrix Developer Network, which explains it in more detail.
This is a good article outlining the problem, but digging around in files to clean up orphaned activites can be a pain, so, like Tim Allen, I wanted more power!! What I wanted was a quick little utility that we could run that would list the cached activities and then allow me to selectively delete the ones I wanted to. So, with some extra time on my hands I figured, lets throw something small together. That’s what I built. You can download the app here. Its not a pretty app, but it does get the job done. NOTE: Before we modify anything in the config file we always make a backup of it. Those backups are located in the “C:\Users\John\AppData\Local\Citrix\Workflow Studio\WorkflowStudio\220.127.116.11′ directory and will have a “Backup” prefix to the file. Like the following screen shot.
Initial loaded screen. It lists your currently cached activities. Here we show you the name, assembly name, weather or not it is shown in the toolbox, and what the toolbox path is (this is where you can find the activity in the activity folder structure)
Once the activities are loaded, you can them multi-select activities and right click, from the popup menu, you can then choose to delete the selected from the cache.
So that’s it for this article. You can download the app from here, but remember, I provide this only as a utility, because I use it during my development process. Please use this tool at your own discretion.
As always, you can contact me via this blog, or ping me on my twitter account @johnmcbride