LoadWithDotNet
PowerScript function
Description
Loads a .NET (6.0 or later) assembly.
Applies to
Syntax
|
1 |
Integer LoadWithDotNet (readonly string assemblypath) |
|
Argument |
Description |
|---|---|
|
assemblypath |
The name and location of the .NET assembly The location can be an absolute path or a relative path. |
Return value
Integer.
Returns values as follows. If any argument’s value is null, the
method returns null.
1 — Success.
-1 — Unknown error.
-2 — Could not find the assembly.
-3 — It’s not a valid assembly.
-4 — The assembly requires a dependent assembly.
Usage
If an application uses LoadWithDotNetCore and LoadWithDotNet at the
same time, the .NET Runtime cannot be the same version, otherwise the
subsequent execution will fail to load. You need to specify different
versions of the .NET Runtime. For the LoadWithDotNet function, the version
can be specified by modifying the pbdotnetinvoker.runtimeconfig.json file.
For more details, refer to https://docs.microsoft.com/en-us/dotnet/core/run-time-config/.
Examples
The following example loads a DLL with .NET (6.0 or later):
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Long ll_return String ls_dll DotNetAssembly lcs_ass //Specifies a DLL in the relative path Ls_dll = "Appeon.Simple.dll" //Instantiates the DotNetAssembly object Lcs_ass = create DotNetAssembly //Loads the DLL Ll_return = lcs_ass.LoadWithDotNet(ls_dll) //Checks the result If ll_return < 0 then Messagebox("Load "+ls_dll+" Failed", lcs_ass.ErrorText) Return ll_return End if |
See also