I have an FB action that calls a custom "Execute Program Action". This calls a C# class. The C# class is derived thus:
public class VCSolutionBuildAction2: ExecuteProgramAction, ICustomExecuteAction
I have overloaded Validate method thus:
public override void Validate( )
This method is being called where I expect, i.e. when the dialog shown by choosing "Edit Action Properties" is closed, and when the action is run. All good.
The validation to be performed depends on when Validate is called, specifically: after the dialog is closed I want to check values are non-empty; but when called when the action is run, I want to validate files exist, etc.
I thought this is where the "Context" members of the base class would come in handy, specifically the "Design time context". However, in both calling cases, the "Design time context" does not exist. (I've attached snapshots of the debugger watch for illustration.)
Am I missing the point on contexts? How do I differentiate, within Validate, the context it's been called in?
Thanks,
PaulS


Ok - I see I get a context in BeforeExecute through which I can send error messages (and return false). This seems the way to go.
Hi Paul,
Validation such as checking whether a file exists should be performed in the actions ‘BeforeExecute’ or ‘Execute’ methods. Also, you don’t need to implement the ‘ICustomExecuteAction’ inteface as well as inherit from ‘ExecuteProgramAction’ as the ‘ExecuteProgramAction’ class is part of the new custom action API which already implements ‘ICustomExecuteAction’. See:
URL: https://www.finalbuilder.com/articles.aspx?mid=370&ctl=ArticleView&articleId=28
Regards,
Paul.
The link you provide shows a class derived from StandardAction. I’m not sure this as a base class is suitable for the problem I am working on.
I need to pass preprocessor defines to the code being compiled (by VS2005). I have done this by deriving a class from ExecuteProgramAction, with appropriate overrides for Valdidate, GetExecutablePath, GetCommandLine, BeforeExecute. In BeforeExecute, I use the EnvDTE automation object to modify the solution’s project preprocessor defines. I also derive from the ICustomExecuteAction interface to get OnSuccess and OnFailure (I need to do further VS automation after the build).
If I derive from StandardAction, I cannot override GetExecutablePath, GetCommandLine or BeforeExecute, and if I don’t derive from ICustomExecuteAction, I don’t get OnSuccess or OnFailure. I’m not sure how StandardAction.Execute can be used to invoke devenv.com and get it’s output back to FB.
Regards,
PaulS
Hi Paul,
Sorry, I posted the article to explain the new custom action API in FinalBuilder 6 but didn’t realise it doesn’t talk about the ExecuteProgramAction base class. You’re correct to be using the ExecuteProgramAction base class when you’re implementing an action that will execute an external process, where as the StandardAction base class should be used when you’re not executing external process.
With regards to OnSuccess & OnFailure, the new base class does not expose these methods, instead you use the InterpretResult method.
Hope this helps,
Paul.