Question: How can I remove an application function and replace calls to it with something different?
First of all, an option that should be considered is to keep your original calls as is, but to fine tune the implementation to use .NET by hand. Then, use a Author/Replace or related command to to swap in in your fine-tuned code.
However, if you really want to change the calls, You may add some refactoring commands to your translation script. In the <
compile> section of the script, do a
remove/remove-stubout with a
migPattern. This will rework the calls. Then, after the <
analyse> section, use
refactor/remove-delete to remove the original. Something like this.
Example1: Here is an example you can try using our ScanTool sample:
Since the methods to be refactored are in a module, these rules will be needed for each VBP that uses the module – unless you moved the module to an IDF using the
Example 2: I have a Declare in a SharedFile, that I want to migrate to a Framework call:
To make things more interesting this Declare was in a module that was shared throughout the system; the declaration is being moved into a host project using the Shared
The Migrate command also adds a migName to the FromCode IDF generated for the translation:
Note that in this case, a "migrated" declaration is authored in the generated DLL code; it must be removed with an Author\Fix.
Note: The XML above uses the Condition attribute of the ScriptRules feature.