这是我第一次使用或.NET框架。
当我第一次尝试构建这个解决方案(https://github.com/QuantConnect/Lean)时--我在他们各自的软件上尝试了解决方案的两个版本(VS17和VS15) --我得到了以下错误(由于相关性原因,本文末尾提到了这些错误)。
从这些错误中,我发现在还原nuget包时会出现问题,但是当我尝试从包含的Nuget控制台安装/重新安装/更新一个包(如QLNet )时,会得到一些错误,例如:
PM> Install package QLNet -Version 1.9.2试图收集与项目“QuantConnect.Lean.Launcher”有关的软件包“QLNet.1.9.2”的依赖信息,目标是“.NETFramework”,Version=v4.5.2‘试图解决软件包'QLNet.1.9.2’与DependencyBehavior‘最低’解析操作的依赖关系,以安装软件包'QLNet.1.9.2‘解析操作来安装从QuantConnect.Lean.Launcher包'QLNet.1.9.2’中成功卸载的'QLNet.1.10.0‘包中删除的包'QLNet.1.10.0’。'C:\Users\Work\QuantConnect\Lean-master\packages‘安装失败。回滚..。包'QLNet.1.9.2‘不存在项目'QuantConnect.Lean.Launcher’包'QLNet.1.10.0‘已经存在于文件夹中,添加包'QLNet.1.10.0’到'packages.config‘安装-软件包:未能添加对'QLNet’的引用。一行:1字符:1+ QLNet -Version 1.9.2 + CategoryInfo : NotSpecified:(:) Install-Package,Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGetCmdletUnhandledException
或
PM> Update -reinstall QLNet试图收集与项目“QuantConnect”有关的多个包的依赖关系信息,以“.NETFramework,Version=v4.5.2”为目标收集依赖信息,尝试解决多个包的依赖关系花费了5,32秒。解析依赖信息需要0 ms解析操作安装在'C:\Users\Work\QuantConnect\Lean-master\packages'.中找到的软件包“QLNet 1.9.2”安装失败。回滚..。执行nuget操作采取了3,73秒更新-包:无法找到中央目录记录的结束。一行:1字符:1+更新-包-reinstall QLNet +~~+ CategoryInfo : NotSpecified:(:)更新-包,异常+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,CategoryInfo
我还从这个页面下载并执行了nuget.exe - recommended latest v4.4.1和VS 2015 VSIX - latest v3.6.0:https://www.nuget.org/downloads,但是没有什么改变。
我该怎么办?
(这就是我尝试构建解决方案时得到的结果:
> 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 ==========
>
> )
发布于 2018-01-15 06:50:01
无法在VS17和VS15上还原nuget包
在构建解决方案之前,您应该还原nuget包。
通常,当我们与其他人共享解决方案时,我们将忽略packages文件夹。因此,在下载该解决方案后,您将找到文件夹:C:\Users\Work\QuantConnect\Lean-master\packages丢失了。
您应该右键单击解决方案,选择还原NuGet Packages。恢复完成后,您可以构建解决方案,而不会出现此错误:

您可以检查该文件夹以确认包是否已被还原。
对于您的问题,我建议您可以删除packages文件夹,然后通过选择“还原NuGet包”来恢复包。
顺便说一下,包还原主要是通过Visual中的Tools > Options > NuGet Package Manager启用的:

详细信息请参见包恢复。
https://stackoverflow.com/questions/48230027
复制相似问题