none
Custom Activities not automatically in toolbox / losing after rebuild

    Question

  • I am having a hard time with items showing up in the toolbox automatically.  I started with a fresh solution, 2 projects - 1 designer, the 2nd a winform.  Everything works perfectly.   We just upgraded our .net 3.5 project to 4.0 [specifically for workflow], and I went through the same steps in 4.0 and the items do not show up automatically in the toolbox.  Checked references, etc. all compiles perfectly.  I have to go into the choose items, manually navigate out to find the .dll, and only then do they show up in the list of controls I can add.  And when I rebuild things the toolbox completely resets - all items gone have to go through it again.

    Does anyone have any suggestions?  Could there be something left over from the .net upgrade that is hosing it up?

    Thanks,

    John

    Wednesday, February 16, 2011 8:44 PM

Answers

  • Thank you everyone for all your help on this.  I opened up a Connect item for it as I think there may be a bug down there somewhere.  This happens only with an Oracle project, not a SQL Server project.  Marking as closed.

    John

    • Marked as answer by John Hennesey Wednesday, February 23, 2011 1:34 PM
    Wednesday, February 23, 2011 1:34 PM

All replies

  • it seems strange. could mail me a simple repro project? my mail box, sophy_yuye@hotmail.com

     

    and which build of VS are you using?

    RTM or BETA or RC?

    Wednesday, February 16, 2011 9:27 PM
  • We are on Visual Studio 2010 Premium, version 10.0.30319.341 RTMLDR.

    I just created a fresh solution and included the two existing projects from the solution that it is behaving strangely, and it works as expected.   It must be something with the solution I am trying to get it working with;  I just read a post somewhere that using solution folders (in vs 2005) caused this type of behavior - we are indeed using solution folders (the folders on the root look washed out with little dotted lines around them - I believe they are solution folders).  I tried moving the two projects out to the root of the solution, closed out VS, opened back up the project, did a clean, rebuild, close it again, reopen and still have the same results.  Unfortunately I am unable to reproduce it in a small project, or send you the source code.  :(  I know these things can get mighty complex, and I do appreciate your help.

    Any insight you can provide is appreciated.
    Wednesday, February 16, 2011 10:17 PM
  • let me try to figure out how you are adding the designer

    1. create a solution folder

    2. add a activity library

    3. build the solution

    4. open one of the workflow console app project item

    observed: can't see the new added activity?

    is this what you are seeing?

     

    other things you can try is

    could you try to follow below post to see whether it can solve your problem

    http://blogs.msdn.com/b/kushals/archive/2009/10/28/toolbox-and-custom-activities.aspx

     

    if this post can't, could you take a look at the below thread, to see whether you hit the same problem as the users there described

    http://connect.microsoft.com/VisualStudio/feedback/details/509806/custom-activities-not-showing-up-in-toolbox

    Thursday, February 17, 2011 12:10 AM
  • Hi John,

    We may need more information to repro your issues.Here maybe some details I would like to know:

    1) You mentioned 'We just upgraded our .net 3.5 project to 4.0 [specifically for workflow]', what version of workflow are you using? Because 3.5 workflow designer is quite different from the 4.0 ones

    2) You said you have 1 designer project and 1 winform project, are these two project referennce the workflow project or the workflow project reference these two project?

     


    This posting is provided "AS IS" and confers no rights or warranties.
    Thursday, February 17, 2011 4:48 AM
    Moderator
  • Ye Yu / Yuanji -

    Thank you both very much for your assistance.  Ye Yu - I went through both posts, and neither of them solved the problem.  Build platform set to any cpu on all projects.  Selecting the "Choose Items" did not solve it - the namespaces for the activities were not available for selection unless I explicitly added the .dll.

    Yuanji - I apologize for the extraneous information - we were not using WF 3.5 - we upgraded our project so we could begin using WF, starting with 4.0.

    I played around with the solution this morning and stumbled into something curious.  My activities are showing up in the toolbox *only* when I go to create a new WPF form.  They do not show up when I create a new activity.  To prove it out I went through the following steps which seems to happen only in the upgraded solution - I am unable to recreate it with a fresh solution created in VS 2010:

    1. Right click on the "folder" I want to create the solution in.  Note I say "folder" because it does not have the standard folder icon - it looks washed out and has a small dotted line around it.  These were created before I started on this project, and they do not appear to be physical folders in the file system.
    2. Create a new Activity Designer Library project.
    3. Add a new Activity Designer item to the solution.
    4. Add a new Code Activity item to the solution.  Set the designer using the [System.ComponentModel.Designer(typeof(ActivityDesigner1))] attribute.
    5. Build the project.
    6. Add a new Activity item to the project.  The activity does not show up on the toolbox.
    7. Add a new WPF Window to the project.  The activity does show up in the toolbox in a tab called "ActivityDesignerLibrary2 Controls"
    With the exception of associating the designer to the code activity all code is as the wizard generated.  I made no modifications.  I will gladly send screen shots if it helps.  Any suggestions are welcomed.
    Thank you,
    John

    Thursday, February 17, 2011 2:09 PM
  • Hi John,
    To try to clarify/simplify,

    1. does it make any difference if you create the project by right-clicking on the solution instead of the folder?

    3. does it make any difference if you skip this step? (I think it has a designer in the project by default)
    4. does it make any difference if you skip this step?
    5. any warnings/errors here?
    6. which activity are you talking about not showing up in the toolbox in step 6?
    7. is it really the activity (CodeActivity1) which shows up here in ActivityDesignerLibrary2 Controls, or is it your activity designer (ActivityDesigner1)?

    Tim

    Thursday, February 17, 2011 7:18 PM
    Moderator
  • Thank you for your fast response.

     

    1. It does not make a difference if I create the project at the root of the solution or in the folder.
    2. Same as #1.
    3. No difference - I didn't need to do this step.  Duh.  I tried it again without creating an activity designer - nor did I touch the one automatically created.
    4. I created a new code activity and did not set the designer.  I left it plain vanilla.  Did not affect the results. :(
    5. There are no errors / warnings when I build just this project.  When I build the solution in it's entirety there are warnings, but no errors.  They consist of declare variables that are never used, unreachable code, some obsolete methods, hiding an inherited member, and a type is defined in multiple assemblies using a global alias.  But none of them apply to the new project I just added.
    6. It was the new code activity added in step 4.  Sorry I wasn't clear.
    7. Indeed it is the activity designer that is showing up in the wpf form - not the activity itself.

    Here is a list of the warnings I got when building the solution - I removed the unused variables and unreachable code detected:
    1. 'System.Xml.XmlReaderSettings.ProhibitDtd' is obsolete: 'Use XmlReaderSettings.DtdProcessing property instead.'
    2. 'Aspose.Pdf.Kit.PdfFileSecurity.EncryptFile(string, string, Aspose.Pdf.Kit.PdfPrivilege, bool)' is obsolete: 'Use EncryptFile with the last KeySize argument'
    3. '[class name removed].PrintDocument(int)' hides inherited member '[class name removed].PrintDocument(int)'. Use the new keyword if hiding was intended.
    4. The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from '\\[server name removed]\buildreferences\NLog\bin\.NET Framework 2.0\NLog.dll'



    Thank you for your help,
    John

    Update: I just created a brand new solution in VS 2010 and added the project I just created for this test.  When I create a new workflow in both 1) directly in the designer library project and 2) any other project in the solution it works fine.  There is something about the existing solution I am creating the new workflow designer library that is preventing it from working as desired.

     

    Thursday, February 17, 2011 7:52 PM
  • can you try that creating a designer library, and bind it to a code activity?
    Thursday, February 17, 2011 9:21 PM
  • I'm sorry, I do not understand.  I did create a blank designer library (project) and placed a code activity inside of it.  Can you please elaborate?  (sorry if i am missing something obvious)
    Thursday, February 17, 2011 9:34 PM
  • can you send me a mail so I can send you a test project and you add the test project to your solution to see whether it work?

    Thursday, February 17, 2011 10:02 PM
  • I just sent a response to your email - attached is a project that I was able to reproduce the behavior.  The steps (as outlined in the email) are as follows:

    1. Create a new project – of type “Oracle Database Project”
    2. Add a new workflow designer project
    3. Add a new code activity to the workflow designer project
    4. Add a new activity to the workflow designer project – when this happens there is a slight flicker in the toolbox.  The flicker is trying to display the controls in a new toolbox tab – too fast for me to read the title.
    5. The toolbox contains only the standard controls
    6. Remove the db project, close out the activity xaml window, and reopen it and the code activity appears in the toolbox.
    Please let me know any additional information I can provide, and thank you for your assistance.

    Friday, February 18, 2011 8:20 PM
  • yes, I'm looking at it now.

    will update today later.

    Friday, February 18, 2011 9:30 PM
  • I have replied your mail.

    after step 4, can you try to rebuild your solution.

    I executed step 1 to 4, and I do see the result as you described, after that, can you try to rebuild your whole solution succeed without remove the database project?

    one more question, is your machine clean with VS installed directly or you upgrade from old version VS?

     

    Friday, February 18, 2011 11:21 PM
  • Thank you everyone for all your help on this.  I opened up a Connect item for it as I think there may be a bug down there somewhere.  This happens only with an Oracle project, not a SQL Server project.  Marking as closed.

    John

    • Marked as answer by John Hennesey Wednesday, February 23, 2011 1:34 PM
    Wednesday, February 23, 2011 1:34 PM
  • What's the Connect ID?

    Anyone have any luck figuring out a workaround? I have another strange issue - created a new CodeActivity and no matter what I do, it refuses to show up in the toolbox. I can remove the other toolbox items and after a bit of fighting get them to reappear, but no matter what I try, even manually adding the assembly, I *cannot* get my CodeActivity to show up.

    Even stranger, I can take the exact logic out of a working CodeActivity, rename the class, compile - still nothing.

    Here's my hypothesis:
    * I have a project for compiling my TFS Build Activities. Nothing more than a simple C# Class Library project, VS 2010 SP1.
    * To use my custom TFS Build activities in the TFS Build Workflow, the assembly must be registered. I gave it a strong name, compiled (a previous version) as Release, and registered it in the GAC.
    * I think there's a strong name issue bug in the Toolbox. Even though it's the same project and a different DLL with a different version, the two are colliding somehow and the Toolbox is picking up the wrong version.

    Removing the assembly from the GAC worked, but it's a huge hassle doing this each time.

    Tuesday, April 05, 2011 4:10 PM
  • http://connect.microsoft.com/VisualStudio/feedback/details/646043/wf-activities-not-showing-in-toolbox-when-oracle-db-project-in-same-solution

    In my case it was related to an Oracle Db project.  Sounds like you may have found something else - good luck.

    Tuesday, April 05, 2011 6:23 PM
  • Hi Shadow Chaser,
    I think this is behavior you describe, which sounds separate to John's issue, and related specifically to Gac'd assembly is by design.

    Because even if the toolbox showed the activities from the non-gacced version of the assembly, you would have problems in this scenario.

    Suppose you can
    1) add in the activity from toolbox
    2) save WF to XAML

    (at this point what's in the XAML file to refer to the activity?
    <p:FooActivity> and xmlns:p="SomeNamespace;assembly=SomeAssembly"
    )

    3) close the WF
    4) load the WF

    At this point XAML API will do regular assembly search, and find the GAC'd assembly - not your other assembly with the same name. So loading the WF will fail - you will see an 'activity could not be loaded' indicator.

    The alternative solutions I would recommend is either you gac your own version of the assembly every time you build, or: find a way to permanently leave it ungaced, or: create a differently named assembly.

    Tim

    Tuesday, April 05, 2011 6:31 PM
    Moderator