When I tried to run “lean backtest myproject” I get this error:
/LeanCLI/CoinGeckoTest.csproj : error NU1202: Package QuantConnect.Lean 2.5.16913 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package QuantConnect.Lean 2.5.16913 supports: net9.0 (.NETCoreApp,Version=v9.0) /LeanCLI/CoinGeckoTest.csproj : error NU1202: Package QuantConnect.DataSource.Libraries 2.5.16913 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package QuantConnect.DataSource.Libraries 2.5.16913 supports: net9.0 (.NETCoreApp,Version=v9.0) /Library/CSharpLibrary/CSharpLibrary.csproj : error NU1202: Package QuantConnect.Lean 2.5.16913 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package QuantConnect.Lean 2.5.16913 supports: net9.0 (.NETCoreApp,Version=v9.0) [/LeanCLI/CoinGeckoTest.csproj] /Library/CSharpLibrary/CSharpLibrary.csproj : error NU1202: Package QuantConnect.DataSource.Libraries 2.5.16913 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package QuantConnect.DataSource.Libraries 2.5.16913 supports: net9.0 (.NETCoreApp,Version=v9.0) [/LeanCLI/CoinGeckoTest.csproj]
So I changed the to 9.0, but now I get this error:
kevin@ubuntu-s-1vcpu-1gb-amd-nyc1-01:~/qcnew/CoinGeckoTest$ lean backtest . Error: This project is targeting Net 9.0 and Net 6.0 is required. Please update the "Target Framework" project setting in VSCode to the new SDK or modify the csproj file directly to "net6.0".
Not sure what to do. I downgraded the lean + datasource libraries to version to 2.5.16704 because that's what ChatGPT But then I get this error:
20250214 14:32:59.366 ERROR:: <>c__DisplayClass4_0.<.ctor>b__0(): System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Could not load type 'QuantConnect.Data.ISymbolProvider' from assembly 'QuantConnect.Common, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null'. at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeModule.GetTypes() at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog() at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator() at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerabl1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerabl1 source) at QuantConnect.Util.Composer.<>c__DisplayClass4_0.<.ctor>b__0() in Common/Util/Composer.cs:line 106 System.TypeLoadException: Could not load type 'QuantConnect.Data.ISymbolProvider' from assembly 'QuantConnect.Common, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null'.
Mia Alissi
Here's a revised plan to tackle the compatibility issues with the .NET SDK and QuantConnect packages:
Select Compatible Versions: Stick with a version of QuantConnect.Lean that is officially supported for .NET 6.0. Downgrade to Lean version 2.5.16704 if needed.
Resolve TypeLoadException: Ensure all assemblies, especially
QuantConnect.Common
, align with the QuantConnect.Lean version you are using.Framework Target Setup: Modify your
.csproj
files to targetnet6.0
:Project Dependencies: Confirm your project's dependency references are consistent with the libraries and versions compatible with
net6.0
:Clear NuGet Caches: Run the following command to clear caches and prevent version mismatches:
Restore Packages: Execute a package restore to ensure you have the necessary dependencies:
Rebuild and Test: Rebuild your project and attempt a backtest:
Continuous Debugging: If issues continue, retry the build or consider resetting the environment.
By applying these steps, you should resolve the compatibility issues and successfully run your backtests on QuantConnect.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Kevin Wheeler
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!