I am trying to accomplish something that seems like it should be very simple. I have a State Machine Workflow Console Application with a workflow in it. I have created a custom activity for it. This activity will NEVER be used ANYWHERE ELSE. I just want to use this activity on my workflow, but:
- It does not appear in the toolbox.
- I cannot drag it from the Solution Explorer onto the workflow designer.
I absolutely do not want to create a separate State Machine Workflow Activity Library, since that will just clutter my solution. Like I said, I will never use this activity in any other project, so I would like to keep it confined to this one...but I just can't figure out how to get it onto the designer! Am I going crazy!?
Here is the code for the activity:
public partial class GameSearchActivity: Activity
{
public GameSearchActivity()
{
InitializeComponent();
}
public static DependencyProperty QueryProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Query", typeof(string), typeof(GameSearchActivity));
[Description("Query")]
[Category("Dependency Properties")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string Query
{
get
{
return ((string)(base.GetValue(GameSearchActivity.QueryProperty)));
}
set
{
base.SetValue(GameSearchActivity.QueryProperty, value);
}
}
public static DependencyProperty ResultsProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Results", typeof(string), typeof(GameSearchActivity));
[Description("Results")]
[Category("Dependency Properties")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public IEnumerable<Game_GamePlatform> Results
{
get
{
return ((IEnumerable<Game_GamePlatform>)(base.GetValue(GameSearchActivity.ResultsProperty)));
}
set
{
base.SetValue(GameSearchActivity.ResultsProperty, value);
}
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
IDataService ds = executionContext.GetService<IDataService>();
Results = ds.SearchGames(Query);
return ActivityExecutionStatus.Closed;
}
}
Thanks.
EDIT:
OK, so I've discovered that if I change the project type from Console Application to Class Library, the custom activity appears in the toolbox. However, this is not acceptable. It needs to be a Console/Windows Application.
Anyone know a way around this?