无法在VS17和VS15

时间:2018-01-12 16:11:55

标签: visual-studio visual-studio-2015 build nuget nuget-package

这是我第一次使用Microsoft Visual Studio或.NET Frameworks。

当我第一次尝试构建此解决方案(https://github.com/QuantConnect/Lean)时 - 我在各自的软件上尝试了两个版本的解决方案(VS17和VS15) - 我收到以下错误(在此末尾显示)发布相关原因)。

从这些错误中我得到了恢复nuget软件包的问题,但当我尝试从附带的Nuget软件包管理器控制台安装/重新安装/更新QLNet等软件包时,我得到错误,例如:

  

PM>安装包QLNet -Version 1.9.2       尝试针对项目'QuantConnect.Lean.Launcher'收集包'QLNet.1.9.2'的依赖关系信息,   定位'.NETFramework,Version = v4.5.2'       尝试使用DependencyBehavior'Lowest'解决包'QLNet.1.9.2'的依赖关系       解决安装软件包'QLNet.1.9.2'的操作       解决了安装包'QLNet.1.9.2'的操作       从'packages.config'中删除了包'QLNet.1.10.0'       已成功从QuantConnect.Lean.Launcher中卸载“QLNet.1.10.0”       包'QLNet.1.9.2'已存在于'C:\ Users \ Work \ QuantConnect \ Lean-master \ packages'文件夹中       安装失败。滚回来...       项目'QuantConnect.Lean.Launcher'中不存在包'QLNet.1.9.2'       包'QLNet.1.10.0'已存在于'C:\ Users \ Work \ QuantConnect \ Lean-master \ packages'文件夹中       将包'QLNet.1.10.0'添加到'packages.config'       安装包:无法添加对“QLNet”的引用。       在行:1个字符:1       +安装包QLNet -Version 1.9.2       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           + CategoryInfo:NotSpecified:(:) [Install-Package],Exception           + FullyQualifiedErrorId:NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

  

PM>更新包 - 重新安装QLNet       尝试针对项目“QuantConnect”收集多个包的依赖关系信息,进行定位   ” .NETFramework,版本= v4.5.2'       收集依赖信息需要5,32秒       试图解决多个包的依赖关系。       解析依赖性信息需要0毫秒       解决操作会安装多个包       在'C:\ Users \ Work \ QuantConnect \ Lean-master \ packages'中找到包'QLNet 1.9.2'。       安装失败。滚回来...       执行nuget动作需要3,73秒       更新包:找不到中央目录结束记录。       在行:1个字符:1       + Update-Package -reinstall QLNet       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           + CategoryInfo:NotSpecified:(:) [Update-Package],Exception           + FullyQualifiedErrorId:NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand

我还从此页面下载并执行了nuget.exe - recommended latest v4.4.1VS 2015 VSIX - latest v3.6.0https://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 ==========
> 
> 

1 个答案:

答案 0 :(得分:1)

  

无法恢复VS17和VS15上的nuget包

您应该在构建解决方案之前恢复nuget包。

通常,当我们将解决方案分享给其他人时,我们会忽略packages文件夹。因此,在您下载该解决方案后,您将找到文件夹:C:\Users\Work\QuantConnect\Lean-master\packages缺失。

您应该右键单击解决方案,选择还原NuGet包。恢复完成后,您可以构建解决方案而不会出现该错误:

enter image description here

您可以检查该文件夹以确认包是否已恢复。

对于您的问题,我建议您删除packages文件夹,然后通过选择" Restore NuGet Packages"来恢复软件包。

顺便说一下,软件包还原主要通过工具>启用。选项> Visual Studio中的NuGet包管理器

enter image description here

有关详细信息,请参阅Package Restore