Error message: CT0002 while coding in VS Code

Created at 28 Dec 2024, 07:00
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
JA

jaco.semko

Joined 27.12.2024

Error message: CT0002 while coding in VS Code
28 Dec 2024, 07:00


Good morning dear cTrader community,
So I have the following Problem:
I wanted to code a Ctrader Indicator over the last days, and I switched to Visual Studio Code from Microsoft, Version 1.96.2.
It seems like everything is working, but when I "build/compile" in VS Code, it gives me the "error CT0002: Assembly must contain algo type."

I`ve read through the "how to section" and through the Forum, but Nothing from there worked for me over the last days.
In the Forum there some People that said that you Need to add something like:
"<PropertyGroup>
  <AlgoBuild>False</AlgoBuild>
</PropertyGroup>"
into the .csproj-file, but different variants didn`t worked out for me, in every code I tried.
and in the "how-to-section" there was said, that you need to  set "AlgoBuild" to "False", but that also didn`t worked out through many variants I tried.
The code it self doesn`t show any errors, that are underlined in red.
Is there a solution?
I appreciate it a lot.
Thank you!


 


@jaco.semko
Replies

EDG777
01 Jan 2025, 14:31

I think you are missing this part:
dotnet add package cTrader.Automate


@EDG777

jaco.semko
02 Jan 2025, 12:02

RE: Error message: CT0002 while coding in VS Code

EDG777 said: 

I think you are missing this part:
dotnet add package cTrader.Automate

Thanks for the response,

In VS Code I went multiple times step by step with the cTrader How to section explanation of how to build cAlgo indis and cBots in other IDE, and in the how to section they have this line included with adding the cTrader.Automate.package

 ( dotnet add .\MyIndicator\MyIndicator.csproj package cTrader.Automate ) and I just tested it again and it still not works… Same Error, but the code is correct and I went after the step by step explanation… 

So I just work with Visual studio for now, but thanks for responding, I appreciate it!

Best regards,

Jacob


@jaco.semko