0
votes

It is my first time ever working with Microsoft Visual Studio or .NET Frameworks.

When I try building this solution (https://github.com/QuantConnect/Lean) for the first time - I tried both versions of the solution (VS17 and VS15) on their respective software - I get the following errors (featured at the end of this post for relevance reasons).

From these errors I get there are issues in restoring the nuget packages, but when I try installing/reinstalling/updating a package such as QLNet from the included Nuget Package Manager Console, I get errors such as:

PM> Install-Package QLNet -Version 1.9.2 Attempting to gather dependency information for package 'QLNet.1.9.2' with respect to project 'QuantConnect.Lean.Launcher', targeting '.NETFramework,Version=v4.5.2' Attempting to resolve dependencies for package 'QLNet.1.9.2' with DependencyBehavior 'Lowest' Resolving actions to install package 'QLNet.1.9.2' Resolved actions to install package 'QLNet.1.9.2' Removed package 'QLNet.1.10.0' from 'packages.config' Successfully uninstalled 'QLNet.1.10.0' from QuantConnect.Lean.Launcher Package 'QLNet.1.9.2' already exists in folder 'C:\Users\Work\QuantConnect\Lean-master\packages' Install failed. Rolling back... Package 'QLNet.1.9.2' does not exist in project 'QuantConnect.Lean.Launcher' Package 'QLNet.1.10.0' already exists in folder 'C:\Users\Work\QuantConnect\Lean-master\packages' Added package 'QLNet.1.10.0' to 'packages.config' Install-Package : Failed to add reference to 'QLNet'. At line:1 char:1 + Install-Package QLNet -Version 1.9.2 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

or

PM> Update-Package -reinstall QLNet Attempting to gather dependency information for multiple packages with respect to project 'QuantConnect', targeting '.NETFramework,Version=v4.5.2' Gathering dependency information took 5,32 sec Attempting to resolve dependencies for multiple packages. Resolving dependency information took 0 ms Resolving actions install multiple packages Found package 'QLNet 1.9.2' in 'C:\Users\Work\QuantConnect\Lean-master\packages'. Install failed. Rolling back... Executing nuget actions took 3,73 sec Update-Package : End of Central Directory record could not be found. At line:1 char:1 + Update-Package -reinstall QLNet + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Update-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand

I also downloaded and executed nuget.exe - recommended latest v4.4.1 and VS 2015 VSIX - latest v3.6.0 from this page: https://www.nuget.org/downloads , but nothing has changed.

What should I do?

(This is what I get when I try building the solution:

>  1>------ Build started: Project: QuantConnect, Configuration: Debug Any CPU ------
>     1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5):
> warning MSB3245: Could not resolve this reference. Could not locate
> the assembly "QLNet, Version=1.9.2.0, Culture=neutral,
> processorArchitecture=MSIL". Check to make sure the assembly exists on
> disk. If this reference is required by your code, you may get
> compilation errors.
> 
> 
> 1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\ConstantQLDividendYieldEstimator.cs(23,7,23,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\ConstantQLRiskFreeRateEstimator.cs(24,7,24,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\ConstantQLUnderlyingVolatilityEstimator.cs(24,7,24,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\IQLDividendYieldEstimator.cs(18,7,18,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\IQLRiskFreeRateEstimator.cs(18,7,18,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\IQLUnderlyingVolatilityEstimator.cs(18,7,18,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\OptionPriceModels.cs(21,7,21,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\QLOptionPriceModel.cs(20,7,20,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\TradingCalendar.cs(7,7,7,12):
> error CS0246: The type or namespace name 'QLNet' could not be found
> (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\OptionPriceModels.cs(25,46,25,76):
> error CS0246: The type or namespace name
> 'GeneralizedBlackScholesProcess' could not be found (are you missing a
> using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\OptionPriceModels.cs(25,78,25,92):
> error CS0246: The type or namespace name 'IPricingEngine' could not be
> found (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\QLOptionPriceModel.cs(26,46,26,76):
> error CS0246: The type or namespace name
> 'GeneralizedBlackScholesProcess' could not be found (are you missing a
> using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\QLOptionPriceModel.cs(26,78,26,92):
> error CS0246: The type or namespace name 'IPricingEngine' could not be
> found (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\QLOptionPriceModel.cs(25,36,25,66):
> error CS0246: The type or namespace name
> 'GeneralizedBlackScholesProcess' could not be found (are you missing a
> using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\QLOptionPriceModel.cs(25,68,25,82):
> error CS0246: The type or namespace name 'IPricingEngine' could not be
> found (are you missing a using directive or an assembly reference?)
>     1>C:\Users\Work\QuantConnect\Lean-master\Common\Securities\Option\QLOptionPriceModel.cs(232,46,232,59): error CS0246: The type or namespace name 'VanillaOption' could not be
> found (are you missing a using directive or an assembly reference?)
>     2>------ Build started: Project: QuantConnect.Indicators, Configuration: Debug Any CPU ------
>     3>------ Build started: Project: QuantConnect.Compression, Configuration: Debug Any CPU ------
>     4>------ Build started: Project: QuantConnect.Queues, Configuration: Debug Any CPU ------
>     5>------ Build started: Project: QuantConnect.Messaging, Configuration: Debug Any CPU ------
>     6>------ Build started: Project: QuantConnect.Api, Configuration: Debug Any CPU ------
>     2>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     7>------ Build started: Project: QuantConnect.Algorithm, Configuration: Debug Any CPU ------
>     7>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     7>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Indicators\bin\Debug\QuantConnect.Indicators.dll'
> could not be found
>     8>------ Build started: Project: QuantConnect.AlgorithmFactory, Configuration: Debug Any CPU ------
>     9>------ Build started: Project: QuantConnect.Algorithm.CSharp, Configuration: Debug Any CPU ------
>     10>------ Skipped Build: Project: QuantConnect.Algorithm.FSharp, Configuration: Debug Any CPU ------
>     10>Project not selected to build for this solution configuration 
>     11>------ Skipped Build: Project: QuantConnect.Algorithm.Python, Configuration: Debug Any CPU ------
>     11>Project not selected to build for this solution configuration 
>     8>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm\bin\Debug\QuantConnect.Algorithm.dll'
> could not be found
>     8>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     3>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     12>------ Build started: Project: QuantConnect.Brokerages, Configuration: Debug Any CPU ------
>     4>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     6>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     13>------ Build started: Project: QuantConnect.VisualStudio15Plugin, Configuration: Debug Any CPU ------
>     5>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     12>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     12>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Compression\bin\Debug\QuantConnect.Compression.dll'
> could not be found
>     9>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm\bin\Debug\QuantConnect.Algorithm.dll'
> could not be found
>     9>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm.Framework\bin\Debug\QuantConnect.Algorithm.Framework.dll'
> could not be found
>     9>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     9>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Indicators\bin\Debug\QuantConnect.Indicators.dll'
> could not be found
>     14>------ Build started: Project: QuantConnect.Lean.Engine, Configuration: Debug Any CPU ------
>     14>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm.CSharp\bin\Debug\QuantConnect.Algorithm.CSharp.dll'
> could not be found
>     14>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm\bin\Debug\QuantConnect.Algorithm.dll'
> could not be found
>     14>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\AlgorithmFactory\bin\Debug\QuantConnect.AlgorithmFactory.dll'
> could not be found
>     14>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Api\bin\Debug\QuantConnect.Api.dll'
> could not be found
>     14>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Brokerages\bin\Debug\QuantConnect.Brokerages.dll'
> could not be found
>     14>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     14>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Compression\bin\Debug\QuantConnect.Compression.dll'
> could not be found
>     14>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Indicators\bin\Debug\QuantConnect.Indicators.dll'
> could not be found
>     15>------ Build started: Project: QuantConnect.ToolBox, Configuration: Debug Any CPU ------
>     16>------ Build started: Project: QuantConnect.Views, Configuration: Release Any CPU ------
>     17>------ Build started: Project: QuantConnect.Jupyter, Configuration: Debug Any CPU ------
>     15>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Brokerages\bin\Debug\QuantConnect.Brokerages.dll'
> could not be found
>     15>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     15>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Compression\bin\Debug\QuantConnect.Compression.dll'
> could not be found
>     15>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Engine\bin\Debug\QuantConnect.Lean.Engine.dll'
> could not be found
>     18>------ Build started: Project: QuantConnect.Lean.Launcher, Configuration: Debug Any CPU ------
>     13>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Api\bin\Debug\QuantConnect.Api.dll'
> could not be found
>     13>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm.CSharp\bin\Debug\QuantConnect.Algorithm.CSharp.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm\bin\Debug\QuantConnect.Algorithm.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\AlgorithmFactory\bin\Debug\QuantConnect.AlgorithmFactory.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Api\bin\Debug\QuantConnect.Api.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Brokerages\bin\Debug\QuantConnect.Brokerages.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Compression\bin\Debug\QuantConnect.Compression.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Indicators\bin\Debug\QuantConnect.Indicators.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Engine\bin\Debug\QuantConnect.Lean.Engine.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Messaging\bin\Debug\QuantConnect.Messaging.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Queues\bin\Debug\QuantConnect.Queues.dll'
> could not be found
>     18>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\ToolBox\bin\Debug\QuantConnect.ToolBox.exe'
> could not be found
>     19>------ Build started: Project: QuantConnect.Tests, Configuration: Debug Any CPU ------
>     17>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm\bin\Debug\QuantConnect.Algorithm.dll'
> could not be found
>     17>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Api\bin\Debug\QuantConnect.Api.dll'
> could not be found
>     17>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     17>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Indicators\bin\Debug\QuantConnect.Indicators.dll'
> could not be found
>     17>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Engine\bin\Debug\QuantConnect.Lean.Engine.dll'
> could not be found
>     17>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Queues\bin\Debug\QuantConnect.Queues.dll'
> could not be found
>     16>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5):
> warning MSB3270: There was a mismatch between the processor
> architecture of the project being built "MSIL" and the processor
> architecture of the reference "Geckofx-Core, Version=45.0.6.0,
> Culture=neutral, PublicKeyToken=3209ac31600d1857,
> processorArchitecture=x86", "x86". This mismatch may cause runtime
> failures. Please consider changing the targeted processor architecture
> of your project through the Configuration Manager so as to align the
> processor architectures between your project and references, or take a
> dependency on references with a processor architecture that matches
> the targeted processor architecture of your project.
>     16>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm.CSharp\bin\Debug\QuantConnect.Algorithm.CSharp.dll'
> could not be found
>     16>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm\bin\Debug\QuantConnect.Algorithm.dll'
> could not be found
>     16>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Api\bin\Debug\QuantConnect.Api.dll'
> could not be found
>     16>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     16>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Engine\bin\Debug\QuantConnect.Lean.Engine.dll'
> could not be found
>     16>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Messaging\bin\Debug\QuantConnect.Messaging.dll'
> could not be found
>     16>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Queues\bin\Debug\QuantConnect.Queues.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm.CSharp\bin\Debug\QuantConnect.Algorithm.CSharp.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Algorithm\bin\Debug\QuantConnect.Algorithm.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\AlgorithmFactory\bin\Debug\QuantConnect.AlgorithmFactory.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Api\bin\Debug\QuantConnect.Api.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Brokerages\bin\Debug\QuantConnect.Brokerages.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Common\bin\Debug\QuantConnect.Common.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Compression\bin\Debug\QuantConnect.Compression.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Indicators\bin\Debug\QuantConnect.Indicators.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Engine\bin\Debug\QuantConnect.Lean.Engine.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Launcher\bin\Debug\QuantConnect.Lean.Launcher.exe'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Messaging\bin\Debug\QuantConnect.Messaging.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\Queues\bin\Debug\QuantConnect.Queues.dll'
> could not be found
>     19>CSC : error CS0006: Metadata file 'C:\Users\Work\QuantConnect\Lean-master\ToolBox\bin\Debug\QuantConnect.ToolBox.exe'
> could not be found
>     ========== Build: 0 succeeded, 17 failed, 2 up-to-date, 2 skipped ==========
> 
> 

)

1

1 Answers

2
votes

Unable to restore nuget packages on VS17 and VS15

You should restore the nuget packages before you build the solution.

Generally, we will ignore the packages folder when we share our solution to others. So after you downloaded that solution, you will find the folder :C:\Users\Work\QuantConnect\Lean-master\packages is missing.

You should Right click the solution, select the Restore NuGet Packages. After restoration complete, you can build the solution without that error:

enter image description here

You can check that folder to confirm whether the packages are restored.

For your question, I suggest that you can delete the packages folder, then restore the package by select the "Restore NuGet Packages".

BTW, Package restore is primarily enabled through Tools > Options > NuGet Package Manager in Visual Studio:

enter image description here

See Package Restore for detailed info.