none
Custom CodeActivity not showing up in Toolbox

    Question

  • Hi,

    I am trying to test out the the Workflow Services feature in VS 2010 Beta 2 and I am having problems with my custom code activity not showing up in the toolbox.  I was following an example and from what it was showing, as soon as I create my CodeActivity class and recompile the application the toolbox should have a section which is my project name and consequently the activity.

    The project is a website and in it I have added a .xamlx file along with a custom code activity.

    Any ideas why I can't see my activities?  (I also tried a xaml activity which didn't work either.)

    Cheers,
    Clint
    clintsinger
    Tuesday, October 20, 2009 8:49 PM

Answers

  • Hi -

    First, apologies for the delay. Thanks Matt for pointing me to the thread.

    I see a couple of issues with the Toolbox, so let me clarify a few points on the B2 Toolbox behavior:

    1. If your custom activity is part of the same project, once you build the project and if the build succeeds, the activity would appear in the Toolbox under the current activity’s namespace name category.

    2. If your custom activity is part of the different project in the same solution though as your workflow, it would appear still appear in the toolbox on a build, again under the activity’ namespace name category. Please specifically note that you would not need to add the project or assembly references to your custom actvity projects into your workflow project. The assembly reference would be added automatically as part of the drag drop of the activity into the workflow.

    3. Finally, if you have an assembly with custom activities which is not part of the solution, then, the user would have to use the “Choose Toolbox Items” dialog launched through the “Choose Items…” context menu in toolbox. In this dialog the user would need to click on the “System.Activities” tab and through the Browse, select the custom activity assembly and click OK.

    This should get the custom activities in the list and clicking on “OK” on this dialog should add the custom activities from this assembly in the toolbox. They would then be added to the category under/from which the Choose toolbox Items was launched. Again, in this case the assembly reference wouldnt be immediately added to the workflow project. Only on the drag-drop of any activity from this assembly, would the assembly reference would be added.

    Now to look into the issues, that I see on the thread:

    1. Enrique - I am extremely sorry, but creating a solution folder and adding a project - Not showing the Toolbox items is what we discussed pretty late in the Beta2 and hence was pushed to RC. We have already fixed this. Once again, sorry for the inconvenience caused.

    2. Clint - The Choose Toolbox Items dialog to come up first time take ~1 min. VS as a whole is working on improving the performance there. Post, first time, the performance should be quick.

    3. Clint - About the webiste projects, again - Yes - In this case as well, it was an issue that came pretty late in the B2 cycle. We have it already fixed in RC. The easiest workaround is to keep the activities in a different project as part of the same solution and that should add the activities as well back to the toolbox for drag-drop.

    Please let me know if you have any questions/concerns. My email is kushals at microsoft dot com.

    Thanks,
    Kushal.

     

     


    Kushal Shah - This posting is provided "AS IS" with no warranties, and confers no rights
    Wednesday, October 21, 2009 9:34 PM

All replies

  • Hi Clint -

    Couple of questions so that I can better help to resolve the issue.

    1. Are you working with Beta1 or Beta2 bits?
    2. Is the activity public?

    Thanks,
    Kushal.
    Kushal Shah - This posting is provided "AS IS" with no warranties, and confers no rights
    Tuesday, October 20, 2009 9:39 PM
  • As Kushal indicated if the activity isn't marked as public it will not show on the toolbox.

    -Amy

    Tuesday, October 20, 2009 11:11 PM
    Moderator
  • I, too, am having this problem with Beta 2 in a project converted from Beta 1.  In Beta 1, everything worked fine, my custom activities showed up.  If I create a blank workflow console application, a custom activity shows up in the toolbox.  I compared the csproj / sln files, and I see no difference.  

    What would cause custom activities to not appear in the toolbox?

    • Proposed as answer by binarycary Friday, January 29, 2010 2:03 PM
    Wednesday, October 21, 2009 12:39 AM
  • First of all, as mentioned in my original post, I am running Beta 2.  I will add that I had Beta 1 installed, uninstalled it and then installed Beta 2.

    The activity is public which is the default when a new activity is created from the "Add New Item" template.  Specifically it is "public sealed".

    Should there be something the the class that should be public as well?

    Cheers,
    Clint


    clintsinger
    Wednesday, October 21, 2009 12:55 AM
  • I tried the same experiment on another computer with a similar project; which is hosting a WCF Service Activity inside a ASP.NET Application Website.  The activities did not show up in the Toolbox as was the case on my first computer.

    I then created a new Workflow Console project and added a new code activity.  In this case the activities did show up in the toolbox.  There appears to be an issue with hosting the .xamlx files in a solution that also contains a website (or perhaps a silverlight application since I had one of those too).  I also tried adding just a project that contains the .xamlx files but it didn't improve the situation.

    Cheers,
    Clint


    clintsinger
    Wednesday, October 21, 2009 1:29 AM
  • ---Using Visual Studio Beta 2---
    Same problem here, it works for a brand new workflow project but in an existing project created using Beta 1 it does not, if you  try to right click on the toolbox\'Choose Items' and browse for the dll containing the activities either the "Choose Toolbox Items" freezes up or VS crashes.
    Wednesday, October 21, 2009 4:17 PM
  • ok it may sound crazy but as RyanHoff I have compared two brand new solutions; in the first all projects are under the solution and the custom activities are populated in the toolbox BUT I noticed that when adding solution folders and adding workflows projects under;  it breaks the TOOLBOX and the custom activities are not being shown any more in the toolbox, you may need to re-open the project to notice it.

    Does it makes any sense?

    Regards, Enrique
    Wednesday, October 21, 2009 4:57 PM
  • I have exactly the same problem. Is there any workaround for this problem?

    It looks like the adding activities to the toolbox using choose items freezes up VS but when you wait for more than a minute the dialog is shown correctly. But there seems to be another problem in the dialog. After choosing an assembly I could not close the dialog.
    Wednesday, October 21, 2009 6:03 PM
  • It seems to be a generalized issue, let’s ask for some help:

    Dear MSFT,

    …………………………………………………………………………………Space reserved for some rant....………………………………………………………….…………………………

    ……………………………………………………………………………………………………….........HELP!!

     

    • Edited by Enrique G. _ Wednesday, October 21, 2009 8:22 PM
    Wednesday, October 21, 2009 7:55 PM
  • Thanks everyone for the notes, I've sent a mail to Kushal and we're looking into it.


    Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle
    Wednesday, October 21, 2009 8:19 PM
  • Guys, I just tried the solution folder again, if I have solution folders the toolbox breaks, once I removed them the custom activities are populated again... Could someone confirm it?
    - create a workflow console app
    - add a solution folder for example "activity 1" and add a activity library project to it
    - add a solution folder for example "activity 2" and add a activity library project to it open up the "Workflow1.xaml" and build the project, the toolbox remains the same, no new activities are shown.
    - now move (drag and drop) the ActivityLibrary1 and ActivityLibrary2 projects right under the solution and delete the solution folders.
    -build the project and open "Workflow1.xaml" and you'll see Activity1 and Activity2 now in the toolbox Regards, Enrique
    Wednesday, October 21, 2009 8:20 PM
  • Hi -

    First, apologies for the delay. Thanks Matt for pointing me to the thread.

    I see a couple of issues with the Toolbox, so let me clarify a few points on the B2 Toolbox behavior:

    1. If your custom activity is part of the same project, once you build the project and if the build succeeds, the activity would appear in the Toolbox under the current activity’s namespace name category.

    2. If your custom activity is part of the different project in the same solution though as your workflow, it would appear still appear in the toolbox on a build, again under the activity’ namespace name category. Please specifically note that you would not need to add the project or assembly references to your custom actvity projects into your workflow project. The assembly reference would be added automatically as part of the drag drop of the activity into the workflow.

    3. Finally, if you have an assembly with custom activities which is not part of the solution, then, the user would have to use the “Choose Toolbox Items” dialog launched through the “Choose Items…” context menu in toolbox. In this dialog the user would need to click on the “System.Activities” tab and through the Browse, select the custom activity assembly and click OK.

    This should get the custom activities in the list and clicking on “OK” on this dialog should add the custom activities from this assembly in the toolbox. They would then be added to the category under/from which the Choose toolbox Items was launched. Again, in this case the assembly reference wouldnt be immediately added to the workflow project. Only on the drag-drop of any activity from this assembly, would the assembly reference would be added.

    Now to look into the issues, that I see on the thread:

    1. Enrique - I am extremely sorry, but creating a solution folder and adding a project - Not showing the Toolbox items is what we discussed pretty late in the Beta2 and hence was pushed to RC. We have already fixed this. Once again, sorry for the inconvenience caused.

    2. Clint - The Choose Toolbox Items dialog to come up first time take ~1 min. VS as a whole is working on improving the performance there. Post, first time, the performance should be quick.

    3. Clint - About the webiste projects, again - Yes - In this case as well, it was an issue that came pretty late in the B2 cycle. We have it already fixed in RC. The easiest workaround is to keep the activities in a different project as part of the same solution and that should add the activities as well back to the toolbox for drag-drop.

    Please let me know if you have any questions/concerns. My email is kushals at microsoft dot com.

    Thanks,
    Kushal.

     

     


    Kushal Shah - This posting is provided "AS IS" with no warranties, and confers no rights
    Wednesday, October 21, 2009 9:34 PM
  • Please post back to this forum as well if any of Kushal's recommendations do or don't resolve your issues.

    Thanks,
    Amy
    Wednesday, October 21, 2009 9:46 PM
    Moderator
  • Finally got it working, I had to:
    -Delete all the solution folders, 
    -Build the solution, 
    -Even when my custom activities project belongs to the same solution as my workflows project, the custom activities didn’t appear by themselves so I added a new tab to the toolbox 
    -Select “Choose Items” browse for my assembly...
    -This time the “Choose Items'” dialog didn’t crash and it listed all my activities…

    Enrique G
    Wednesday, October 21, 2009 10:34 PM
  • Hi Kushal,

    It appears that manually adding activities via the "Choose Items" option worked.  I was able to import activies from an seperate activity library assembly as well as my web application assembly directly.


    Having another Activity Library project in the same solution as my web project did not cause the items to automatically appear in the toolbox. As mentioned above, I had to manually add activities from this project as well.

    Cheers,
    Clint


    clintsinger
    Thursday, October 22, 2009 2:34 PM
  • In my testing, deleting solution folders (or any other items in the solution tree which cause issues) from solution explorer would fix the problem, but you also need to close and re-open the solution after doing so.

    Tim
    Friday, October 23, 2009 5:36 PM
    Moderator
  • I was just lucky enough to experience this same bug.  In my case, it occurred once I added a unit test project to my solution.  The unit test project adds a solution folder with several test-related items in it.  I removed those items from the solution and all is well again.

    Bruce Bukovics http://www.learnworkflow.com
    Wednesday, October 28, 2009 8:14 PM
  • Here's my variation. This happened as I was working on some demo code, then I found tihs thread (many thanks to all that contributed) and then I repro'd it with slightly different steps:

    Create a WF Console app
    Add a CodeActivity, build, toolbox has custom activity
    Create a TextFile as a solution item in the same solution (creating the solution folder)
    All is still good, toolbox has custom activity
    Create another console app project in the same solution
    Add a CodeActivity to it, build
    Toolbox is not missing custom activities for the default activity in both projects

    Thanks for your attention.

    What I disliked most may be too late to fix. When this is broken for any reason, there doesn't seem to be a way to ask the toolbox to refresh itself. I hope this is part of general attention to the toolbox in VNext. The reset thing might do tihs, but as I've had to out-wait it before, I think its a useless solution at present.

    Thanks!
    Kathleen

    Tuesday, November 10, 2009 11:30 PM
  • I'm on Beta2, and am trying to go through the basic tutorial, and am seriously struggling with custom activities
    I have one code activity in the same project as the workflow, and that usually shows ok. 
    I then create the custom activity library, with a native activity and its virtually impossible to get this to show up. 
    If I unload and re-load the custom activity project, sometimes it will show up, more often than not it will not.

    If I remove it from the solution, the code activity does appear in the tool box.
    I add the custom activity project again, both do not appear in the tool box

    This is really fraustrating! and I can't progress.

    Yossi Dahan http://www.sabratech.co.uk/blogs/yossidahan [To help others please mark replies as answers if you found them helpful]
    Friday, December 04, 2009 2:03 PM
  • Hi Yossi,
    Do you think this a different problem from the ones above? Could you describe the solution structure?
    Tim
    Saturday, December 05, 2009 9:06 PM
    Moderator
  • Hi Tim, and thanks for the reply

    I think so, but not sure yet. 
    I (hope) I have followed the Into to WF lab in the VS2010 tutorial to the letter which mean I have a test project with some unit tests, another project with my custom activity, a third project with my custom activity's designer and a fourth project with my workflow.
    The workflow project used to have a code activity, I've tried removing it but it did not make any difference.
    Unloading the custom activity project made the code activity appear in the toolbox (whilst it was in the workflow project), re-adding the custom activity project made them both disappear.

    I've tried various things and occasionally I could get the activities to appear in the toolbox, but not consistently.

    Yossi

    Yossi Dahan http://www.sabratech.co.uk/blogs/yossidahan [To help others please mark replies as answers if you found them helpful]
    Monday, December 07, 2009 8:40 AM
  • Hi,
    I am having the same problem with Beta 2. I have a project with several custom activity libraries and all activities were showing up in the toolbar. Then one fine day I decided to move the solution to a different folder and all custom activities went away. I can't even see activities created in the same project.
    My solution structure is:

    Solution:
              Solution Folders1
              Solution Folders2
              Solution Folders3
       Activities library Set1
       Activities library Set2
       Activities library Set3
       Activities library Set4
       Workflow Service XAMLX (which uses all the above libraries)


    I have tried cleaning all the projects, rebuilding and adding new activities to get any activity to show up in the toolbar but nowthing worked.

    I can add activities manually by selecting the assembly from "choose item"  menu.

    Muazzam
    Monday, December 07, 2009 5:58 PM
  • Hi Yossi,
    Thank you for the reply. If you're following the Intro to WF lab, the one with the unit tests, then yes, I think you will be hitting exactly the same issue as the other posters - the Unit Tests include/act like a Solution Folders item.

    Hi MuazzamAli,
    Thanks for adding your information. I believe it is also the same issue (the problem that happens with Solution Folders). As Kushal says, the issue should be fixed in the next release.

    Tim
    • Proposed as answer by Yossi Dahan Tuesday, December 08, 2009 8:55 AM
    Tuesday, December 08, 2009 2:11 AM
    Moderator
  • Thanks for the help Tim

    Did not understand the issue correctly before, but seem to be sorted now. appreciated.

    In case it help others - the problem doesn't seem to be the test project per-se (I have tried removing it even before posting the question here), but the solution items folder created when one adds it.

    I've removed the folder as well and my custom activity showed up in the tool box (after rebuilding the solution)





    Yossi Dahan http://www.sabratech.co.uk/blogs/yossidahan [To help others please mark replies as answers if you found them helpful]
    Tuesday, December 08, 2009 8:54 AM
  • Hi -

    First, apologies for the delay. Thanks Matt for pointing me to the thread.

    I see a couple of issues with the Toolbox, so let me clarify a few points on the B2 Toolbox behavior:

    1. If your custom activity is part of the same project, once you build the project and if the build succeeds, the activity would appear in the Toolbox under the current activity’s namespace name category.

    2. If your custom activity is part of the different project in the same solution though as your workflow, it would appear still appear in the toolbox on a build, again under the activity’ namespace name category. Please specifically note that you would not need to add the project or assembly references to your custom actvity projects into your workflow project. The assembly reference would be added automatically as part of the drag drop of the activity into the workflow.

    3. Finally, if you have an assembly with custom activities which is not part of the solution, then, the user would have to use the “Choose Toolbox Items” dialog launched through the “Choose Items…” context menu in toolbox. In this dialog the user would need to click on the “System.Activities” tab and through the Browse, select the custom activity assembly and click OK.

    This should get the custom activities in the list and clicking on “OK” on this dialog should add the custom activities from this assembly in the toolbox. They would then be added to the category under/from which the Choose toolbox Items was launched. Again, in this case the assembly reference wouldnt be immediately added to the workflow project. Only on the drag-drop of any activity from this assembly, would the assembly reference would be added.

    Now to look into the issues, that I see on the thread:

    1. Enrique - I am extremely sorry, but creating a solution folder and adding a project - Not showing the Toolbox items is what we discussed pretty late in the Beta2 and hence was pushed to RC. We have already fixed this. Once again, sorry for the inconvenience caused.

    2. Clint - The Choose Toolbox Items dialog to come up first time take ~1 min. VS as a whole is working on improving the performance there. Post, first time, the performance should be quick.

    3. Clint - About the webiste projects, again - Yes - In this case as well, it was an issue that came pretty late in the B2 cycle. We have it already fixed in RC. The easiest workaround is to keep the activities in a different project as part of the same solution and that should add the activities as well back to the toolbox for drag-drop.

    Please let me know if you have any questions/concerns. My email is kushals at microsoft dot com.

    Thanks,
    Kushal.

     

     


    Kushal Shah - This posting is provided "AS IS" with no warranties, and confers no rights

    Hi Kushal,

    I too experience the same issue as well on the Visual Studio 2010 Ultimate. For my case it happen right after I select reset toolbox when there was a clutter of custom activities and standard activities (all of them created a duplicate of iteself). After cleaning the toolbox, I never get to see all my poor custom activities again. *sob..*

    But if I recreate another WF console project and reference my Activity Library projects, they come back alive (",). However my original main startup project is now screwed and had to put the poor fella to RIP.

    I hope the next release you are able to give us some way to resurrect the poor chap.

    Arigato,
    Wednesday, December 16, 2009 8:43 AM
  • Hello Yossi,

    I can confirm the experience you had. Test projects do not seem to be the issue.

    I had a solution with a couple of testprojects. Next i added an Activity Library, with a couple custom activities. Adding my custom activities from the toolbox to a workflow in the same project, you guessed it, did not work because they didn't appear in the toolbox :).

    After removing the solution folder and cleaning the solution my custom activities appeared. Test projects were not removed from my solution.

    Kind regards,

    Maurice
    Maurice Peters
    Monday, December 28, 2009 6:48 PM
  • Hi Kushal,

    I notice that this thread is quite old and we are all long past using the Beta release.  I'm using VS 2010 Professional and I'm having problems with displaying my custom activities in the toolbox.  My Activity Library contains 2 activities right now:

    Activity 1 (came with Porject 2010 SDK)
    Activity 2 (custom one I created and added to the same library).

    If I include the activity library as part of my workflow solution, then both acitivities show up fine in the toolbox.  But if I want to keep the activity library as a separate assembly and not include it into solutions (just reference it), that's where toolbox oddities begin.  I did exactly the same things that you mentioned, namely: 1) referenced ActivityLibrary in my solution; 2) manually added a Tab on the Toolbox and through "Choose Items" browsed to the assembly.  Activity 1 is the only one that shows up.  The toolbox DOES NOT see the Activity 2, although the Object Explorer does.  The new activity is there, but not as far as Toolbox is concerned.  Any ideas?

    I've noticed odd behavior with Toolbox before.  I won't be able to reproduce it right now because it's been a little while back, but I remember I manully had to drag items from one custom tab to another because I couldn't get it to work right.  I think in summary what was happening is I created first custom tab, added contents to it through "Choose Items", then created a second custom tab, tried to add contents to that tab as well, but after clicking OK, the toolbox overwritten the contents of Tab 1 with contents intended for Tab 2 and left Tab 2 empty.

    I tried everything but wasn't able to obtain proper behavior.  Have no doubt that the Toolbox still has some problems (with synchronization/tab pointing, perhaps).  Would appreciate your input if you happen to read this thread again.

    Thank you,
    Ilya

    Friday, September 16, 2011 6:45 PM