Skip to content

Migrate from .NET Framework

Migrate to .NET 6.0

cTrader Windows migrated from .NET Framework to .NET 6.0 in version 4.2. This resulted in a number of significant changes to the UI and how cBots and indicators are compiled and built.

Key changes

Prior to the migration, cTrader was using .NET Framework 4.0 (and C# version 4). All algos were running inside the main cTrader Windows process.

After migration, cTrader now uses separate child processes for indicators and cBots. It also uses a dedicated NuGet package for building .algo files.

That said, new releases of cTrader are backwards compatible with code written before the migration. Apart from a few exceptions, you can freely use indicators and cBots that were built in older versions of cTrader.

Note

Some parameter names and methods have been changed during the migration. When building your old cBots or indicators in newer versions of cTrader, you may receive build errors or warnings because of this. Consult the reference library to learn the new method or parameter names and method overloads.

How to migrate to .NET 6.0

To migrate from .NET Framework to .NET 6.0, rebuild your indicators and cBots inside cTrader Windows 4.2 or newer. During rebuilding, cTrader will automatically change the .NET project structure to the new SDK style.

After rebuilding, change your indicator or cBot target framework to .NET 6.0 via the Target framework dropdown menu.

Image title

Test your indicator or cBot after rebuilding.

Note

If your indicator or cBot uses File, Registry or Internet access rights, change them to FullAccess.

In version 4.2, cBots and indicators using multiple threads cannot call any API members. This can be addressed by using the BeginInvokeOnMainThread method to call an API method or member. Otherwise, your code will throw an error.

As the cTrader Algo API is not thread safe, you must to use the BeginInvokeOnMainThread method whenever you call or access an API member.