Build Code (C# to DLL) & Invoke Method
Overview
The Build Code feature allows you to include C# source files (.cs) directly in an akaBot Studio project, compile them into a local assembly (.local\Custom_Code.dll), and invoke custom methods within your workflows using the Invoke Method activity.

1. Compiling C# Source Files
Follow these steps to compile your C# code into a usable assembly:
-
Add C# source files to your project:
- Create or copy
.csfiles into your project directory (e.g.,JsonDownload.cs). - Define your custom classes and public methods (static or instance).

- Create or copy
-
Run Build Code:
- Click Build Code in the Studio ribbon.
- Studio compiles all
.csfiles and generates.local\Custom_Code.dll, updating.local\cache.json.
-
Restart Studio:
- A confirmation prompt lists the compiled files and prompts you to restart.
- Click Restart Studio to reload the project with the new assembly.
2. Invoking Compiled Methods
After restarting Studio, use the Invoke Method activity (System.Activities.Statements.InvokeMethod) to call your compiled C# methods.

Configure the following properties:
| Property | Description |
|---|---|
| TargetType | For static methods: browse and select the compiled C# class (e.g., MyCompany.Helpers.DataProcessor). |
| TargetObject | For instance methods: provide the instantiated object variable. |
| MethodName | The exact name of the method to invoke (e.g., ProcessInvoice, ComputeHash). |
| Parameters | Input and output arguments matching the C# method signature. |
| Result | A workflow variable to capture the method's return value. |
