If you have some legacy (old) cBots and indicators that you created before cTrader Desktop 4.2 was released and you want to upgrade them to the new .NET framework version 6, we will show you how to do this.
- Open cTrader Desktop 4.2
- Go to the Automate window.
- Select your cBot or indicator so you can see your source code on the right-hand side.
- At the top you will see an option for the Target Framework.
- Change this to .NET 6
- Build the cBot or Indicator.
- Backtest your cBot to make sure it works correctly.
If this builds successfully then we have now converted the project from the old .NET 4.x framework to the .NET 6, we can now open the project using Visual Studio 2022
You may see orange warnings in the build result window, you can ignore this as it is just telling you that you are using obsolete old code, it will still work fine, if you see red build errors then you may have to manually upgrade parts of the code.
Upgrades only work for basic single file cBots & Indicators, complex projects need manual updating.
How to Edit in Visual Studio 2022
To edit and work on your project using Visual Studio 2022 could not be easier, you just right click your mouse on the cBot or Indicator and choose Edit with Visual studio, the IDE will open and you can start editing the code, if you build the project it will create your cBot or indicator ready to test.
.NET 6 Missing?
You may find that when you have upgraded your project in cTrader Automate to .NET 6 and then edit in Visual Studio 2022 you get the error below.
If this happens you need to install .NET 6 as standard Visual Studio 2022 is shipped with .NET 5. Once you have installed .NET 6 you need to update the target framework in the project settings.
Using Visual Studio 2022 with old cBots
You cannot edit your old legacy projects using .NET 4.x with Visual Studio 2022, you need to continue to use VS 2019 to edit and build your projects, if you have created complex projects using classes and external libraries or NuGet packages then you will have to upgrade manually.
Watch a Video Explainer
I have also created a video explainer showing all of the above and how it works in practice.
cTrader Desktop 4.2 New Features
You can find out about all the new features with the latest release of cTrader below.