Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Vb6
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
...
Sleep 500

We want no declaration and calls like this:

...
System.Threading.Thread.Sleep(500);

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

Code Block

<Compile Condition="%SrcName%=='AppCommon'">
   <Refactor>
      <Migrate id="GlobalDeclarations.Sleep" nPram="2" migName="System.Threading.Thread.Sleep" migStatus="external" />
   </Refactor>
</Compile>

Changes the calls in AppCommon as expected

...

Code Block
FromCode\AppCommon.dll.xml

      <method id="Sleep" migName="System.Threading.Thread.Sleep" type="Void">
         <argument id="dwMilliseconds" type="Integer" status="ByVal"/>
      </method>

The IDF change makesmigName attribute alters calls made to the migrationmethod in allthe codes that reference the AppCommon .DLL.

Note that in this case, a "migrated" declaration is authored in the generated DLL code; it must be removed with an Author\Fix.

Code Block
<Author Condition="%SrcName%=='AppCommon'">
<Fix host="%SrcName%" name="PostEdit">
   <Replace name="Remove GlobalDeclaration.Sleep">
   <OldBlock><![CDATA[
         [DllImport("kernel32")]
         public static extern void System.Threading.Thread.Sleep(int dwMilliseconds);
   ]]></OldBlock>      
   </Replace>
</Fix>
</Author>

Note: The XML above uses the Condition attribute of the ScriptRules feature.