Description
Loads a .NET Core assembly.
Applies to
DotNetAssembly objects
Syntax
objectname.LoadWithDotNetCore ( readonly string assemblypath {, string dotnetcoreversion })
Argument |
Description |
---|---|
objectname |
The name of the DotNetAssembly object. |
assemblypath |
The name and location of the .NET assembly (*.dll). The location can be an absolute path or a relative path. When a relative path is executed in the development environment, it is relative to the location of the PBT file; when a relative path is executed in the production environment, it is relative to the installation location of the application's executable file. |
dotnetcoreversion (optional) |
The highest .NET Core version to be supported. 2.1 and later versions are supported. For example, if the value is 3, it supports 3.x, the latest release for version 3 which is currently installed on the machine. If the value is not specified, it supports the latest version currently installed on the machine. |
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.
-19 -- Cannot find the .NET Core runtime.
-20 -- Failed to load the .NET Core virtual machine.
Examples
The following example loads a DLL with .NET Core 2.1.6:
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 with .NET Core 2.1.6 ll_return = lcs_ass.LoadWithDotNetCore(ls_dll,"2.1.6") //Loads the DLL with the most curret .NET Core version on this machine //ll_return = lcs_ass.LoadWithDotNetCore(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