Cannot compile class libraries (.Net 6.0) when referencing cTrader.Automate package

Created at 31 Mar 2022, 16:08
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!
YR

YrpWayne

Joined 06.03.2019

Cannot compile class libraries (.Net 6.0) when referencing cTrader.Automate package
31 Mar 2022, 16:08


When trying to convert class libraries over to .net 6.0 and build them I'm running into a problem with the embedded targets file trying to search for a Robot or Indicator.

1>C:\Users\User\.nuget\packages\ctrader.automate\1.0.0\build\cTrader.Automate.targets(35,9): error CT0002: Assembly must contain algo type.

 

The libraries are just that libraries, they don't implement the Robot or Indicators directly as they're consumed in other projects which deal with that step. Is there a way to bypass the algo packaging steps to work around the problem?

 

 


@YrpWayne
Replies

YrpWayne
31 Mar 2022, 16:13

Never mind, figured out there's a property that can be set which bypasses the build.

Add the below snippet to your library .csproj file:

<PropertyGroup>
  <AlgoBuild>False</AlgoBuild>
</PropertyGroup>

Hope that helps someone else.


@YrpWayne

patrock333
20 May 2023, 23:47

RE:

YrpWayne said:

<PropertyGroup>
  <AlgoBuild>False</AlgoBuild>
</PropertyGroup>

Hope that helps someone else.

Thanks for this.

I couldn't find a solution anywhere to get rid of that error.

It took me a while to figure out how to add this to my csproj file, I'm new to C# and Visual Studio.

I just added it in C:\...\.nuget\packages\ctrader.automate\1.0.7\build\cTrader.Automate.targets.


@patrock333