Compiling and Building
You can use two types of compilers when compiling/building in cTrader Automate:
- The embedded compiler
- The .NET SDK compiler
By default, cTrader Automate uses the embedded compiler but we recommend you change it to the .NET SDK compiler if you have one installed on your local machine.
To change the cTrader Automate compiler, click on the 'cog' icon in the bottom-left corner of the UI to open the cTrader settings. From here, switch to the 'Automate' tab.
The Embedded Compiler¶
The embedded compiler is built-in into the cTrader desktop platform. In comparison to the .NET SDK compiler, it has very limited features. For instance, the embedded compiler does not support any third-party .NET packages and technologies such as WinForms and WPF.
The .NET SDK Compiler¶
The usage of the .NET SDK compiler is strongly recommended for large projects or extensions that use third-party .NET libraries. The .NET SDK compiler also supports additional features such as build parameters.
The 'Select Compiler' menu enables choosing any .NET SDK compiler you have installed on your local machine. If no versions of the .NET SDK are installed, you can always click on the 'Install .NET SDK' button to be taken to the download page for the latest stable release.
cTrader Automate has several customizable parameters that you can refer to when using .NET CLI when building your cBots/indicators. They are defined below.
|AlgoName|| ||Out |
Important: this property does not affect the
|AlgoBuild|| ||Enables building |
|AlgoPublish|| ||Enables copying |
|IncludeSource|| ||Includes the source directory to the target |
|IncludeSymbols|| ||Includes the debug symbols to the target |
Handling an Additional Error
If you reference the cTrader.Automate Nuget package in your class library project that does not contain any cTrader algo classes in it (e.g.,
Robot for a cBot), you will encounter the "Assembly must contain algo type" error when you try to build the project. This error arises since the
AlgoBuild parameter equals
True by default. To fix the issue, simply set
False in your .NET project file as seen in the below example.
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net7.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <AlgoBuild>false</AlgoBuild> </PropertyGroup> <ItemGroup> <PackageReference Include="cTrader.Automate" Version="1.*-*" /> </ItemGroup> </Project>