Correct way to use @import in script files
Correct way to use @import
To import a .Net dll file say for example System.Web.Services your code should be as below
//@import System.Web.Services;
To import an Activate Parameter say for example Script parameter on Root of Distribution Lists Resource your code should be as below
//@import=//Resources/Distribution Lists/Script
Note: You should not have a space after @import when you are using an Activate Expression where as if you are importing a .net dll file you should have a space after @import
Correct way to use @include
The @include is used to reference another Activate Script typically on the same task. For example the Activate Script that is used to terminate users using the Delete User Task is the DeleteUserScript. This script uses the @include to reference the DeleteUtilities script located in the Delete User Task, which contains a number of functions that can be re-used rather than defining all these functions in the DeleteUserScript.
//@include=/DeleteUtilities
Note: Ensure you only have a single / in front of the script you wish to include and no space after the @include.
Difference between @include and @import
When you use @include all the text from the referenced Activate Script file is appended and then compiled. Where as if you use @import, the code in the referenced script file is compiled separately.
There are two usages of @import one for a Script and one for an existing DLL.
If you @import a script then it is compiled to a DLL and then used.
If you @import an existing DLL then it is just used.
Note: @include should not be used unless there is a specific use case. Prefer using @import instead.
Note: Do not leave any blank lines in between any includes and/or imports as the ones below the line break will not compile and will break any references.
E.g. Line break on line 2 breaks the import for System.Management.Automation. Removing the line break fixed it.