NuGet软件包还原失败(仅在命令行上) [英] NuGet package restore for solution fails (only on the command line)

查看:5820
本文介绍了NuGet软件包还原失败(仅在命令行上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近切换到NuGet的最新推荐方法,该方法为项目使用了一个`package.json'文件:

  {
dependencies:{
Newtonsoft.Json:9.0.1,
RestSharpSigned:105.2.3
},
框架:{
net45:{}
},
runtimes:{
win:{}
}
}

这在我的本地Visual Studio环境中很有效,但是CI服务器不能再构建项目。 / p>

奇怪的是,我可以看到成功地为解决方案恢复了包,但是在构建时,MSBuild不知道这些DLL在哪里,所有对它们的引用失败: / p>

套件还原成功:

  09:48:07更新NuGet。 exe到3.4.4-rtm-final。 
09:48:07更新成功。
09:48:08 MSBuild自动检测:使用msbuild版本'14 .0'从
'C:\Program Files(x86)\MSBuild\14.0\bin'。
09:48:09恢复C:\ jenkins-test\ ... \Client\Client.NET45.project.json ...的包...
09:48:10安装RestSharpSigned 105.2.3。
09:48:10安装Newtonsoft.Json 9.0.1。
09:48:13提交还原...
09:48:13提交恢复...
09:48:13 C:\jenkins-test\ ... \\ \\Client\Client.NET45.csproj
09:48:13恢复完成在3715ms.09:48:13安装:
09:48:13 2包到C:\jenkins -test\ ... \Client\Client.NET45.csproj

构建失败: / p>

  09:48:14 Microsoft(R)Build Engine版本14.0.23107.0 
...
09 :48:14项目C:\jenkins-test\ ... \Client.sln(1)正在构建
C:\jenkins-test\ ... \Client\\ \\Client.NET45.csproj(2)在节点1(默认目标)。
09:48:14 PrepareForBuild:
09:48:14创建目录bin \Debug\\\
et45\。
09:48:14创建目录obj \Debug\。
09:48:14 CoreCompile:
09:48:14 C:\Program Files(x86)\MSBuild\14.0\bin\csc.exe / noconfig / nowarn:1701, 1702 / nostdlib + / errorreport:prompt / warn:4 /doc:bin\Debug\\\
et45\Client.xml / define:DEBUG; TRACE; NET45 / higntropyva + / reference:C:\Program Files(x86) \\参考组件\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll/ reference:C:\Program Files(x86)\Reference Assemblies \Microsoft\Framework\。 NETFramework\v4.5\System.Core.dll/ reference:C:\Program Files(x86)\Reference Assemblies \ Microsoft\Framework\.NETFramework\v4.5\System。 dll/ reference:C:\Program Files(x86)\Reference Assemblies \Microsoft\Framework\.NETFramework\v4.5\System.Runtime.Serialization.dll/ reference:C: \ Program Files(x86)\ Reference Assemblies \Microsoft\Framework\.NETFramework\v4.5\WindowsBase.dll/ debug + / debug:full / filealign:512 / optimize- / out:obj\\ \\ Debug \Client.dll / ruleset:C:\Program Files(x86)\Microsoft Visual Studio 14.0 \Team Tools \Static分析工具\\rule Sets \MinimumRecommendedRules.ruleset/ subsystemversion: 6.00 / target:library / utf8output API\API.Authentication.cs API\API.Configuration.cs API\API.Parameters.cs API\API.Requests.cs API\API.Utilities.cs API\ Authentication\AccessTokenStatus.cs API \Authentication\AuthenticationStatus.cs API \Authentication\BasicAuthenticationToken.cs API \Authentication\IAccessToken.cs API \Authentication\OauthAccessToken.csAPI \Custom Exceptions \ APIRequestException.csAPI\Custom Exceptions\NotWaitingException.csAPI\ExtensionMethods\ExtensionMethods.IAPIResourceView.cs API\ExtensionMethods\ ExtensionMethods.IAPIResource_WithDataEndpoint.cs API\ExtensionMethods\ ExtensionMethods.IAPIType.cs API \ExtensionMethods\ExtensionMethods.Reference.cs API\ExtensionMethods\ExtensionMethods.Rest.cs API\ExtensionMethods\ExtensionMethods.Rest.InferredType.cs API\JsonConverters\AnalyzeReContractResolver.cs API \JsonConverters\AnalyzeReJsonConverter .cs API\JsonConverters\ComplexNestedObjectConverter.cs API\JsonConverters\DerivedResourceCreationConverter.cs API\JsonConverters\JsonCreationConverter.csAPI\JsonConverters\JsonCreationConverter [T] .csAPI\JsonConverters\JsonSerializerExtensionMethods .cs API\JsonConverters\LayerViewCreationConverter.cs API\JsonConverters\PortfolioViewSerializer.cs API\JsonConverters\ReferenceConverter.cs API\JsonConverters\UriConverter.cs API\LargeDataUpload\AdaptiveBufferedBytesProducer.cs API\ LargeDataUpload\BufferedBytes.cs API\LargeDataUpload\BufferedBytesFromStreamProducer.cs API \LargeDataUpload\BufferedBytesResizer.cs API\LargeDataUpload\BufferedBytesToStringProducer.cs API \LargeDataUpload\BufferProducerException.cs API \LargeDataUpload\GZipBufferedBytesProducer。 csAPI\LargeDataUpload\ Internal Classes\LargeDataUpload.AsyncParameters.csAPI\LargeDataUpload\ Internal Classes\LargeDataUpload.Exceptions.csAPI\LargeDataUpload\ Internal Classes \LargeDataUpload.HandleUploadInSessionStrategy。 csAPI\LargeDataUpload\ Internal Classes\LargeDataUpload.Parameters.csAPI\LargeDataUpload\ Internal Classes\LargeDataUpload.StatusReponse.csAPI\LargeDataUpload\IProducerConsumerBuffer.cs API \LargeDataUpload\\ \\LargeDataUpload.cs API\LargeDataUpload\ProducerConsumerBuffer.cs API\Rest\IRestResponse.cs API\Rest\Method.cs API\Rest\Parameter.cs API\Rest\ParameterType.cs API \Rest\ResponseStatus.cs API\Rest\RestResponse.csAPI\Rest\RestResponse [T] .csAttributes\APITypeAliasAttribute.cs Attributes\GreaterThanAttribute.cs Attributes\LessThanAttribute.cs属性\NotEmptyAttribute.cs Attributes\NotNullAttribute.cs Attributes\NumericValidationAttribute.cs Attributes\PropertyAlias.cs Attributes\ResolvedInViews.cs Attributes\ServerGenerated.cs Attributes\ServerHasDefault.cs Attributes\ServerHasDefaultEmptyObject.cs Attributes\ ValidationAttribute.cs Model\APITypes\APIResource_WithDataEndpoint.cs Model\APITypes\APIType_Polymorphic.cs Model\APITypes\Interfaces\IAPIResource_WithDataEndpoint.cs Model\APITypes\Interfaces\IAPI_Polymorphic.cs Model\APITypes\\ \\Interfaces\IStoredAPIResource.cs Model\APITypes\OptionsResponse.csModel\APITypes\REST Entities\ResourceStringBuilder.csModel\APITypes\REST Entities \SubResources\CommandSubResource.cs Model\APITypes\REST Entities\SubResources\DataSubResource.csModel\APITypes\REST Entities \SubResources\LargeDataSubResource.csModel\APITypes\REST Entities\SubResources\ResourceEndpoint .csModel\APITypes\REST Entities\SubResources\SubResource [T] .csModel\APITypes\ServerError.cs Model\APITypes\StoredAPIResource.cs Model\APITypes\StoredAPIResource_Polymorphic。 cs Model\Common\APIResource.cs Model\Common\APIResourceView\AggregationMethod.cs Model\Common\APIResourceView\BaseAPIResourceView.BackAllocations.cs Model\Common\APIResourceView\BaseAPIResourceView.CoMetrics.cs Model\Common\APIResourceView\BaseAPIResourceView.cs Model\Common\APIResourceView\BaseAPIResourceView.ExceedanceProbabilities.cs Model\Common\APIResourceView\BaseAPIResourceView.TailMetrics.cs Model\Common\APIResourceView\IAPIResourceView .cs Model\Common\APIResourceView\State.cs Model\Common\APIResourceView\TargetCurrencyDefault.cs Model\Common\APIResourceView\YELTSimulationResult.cs Model\Common\APIResourceView\YLTSimulationResult.cs Model\Common\APIType.cs Model\Common\CollectionResponse\CollectionResponseMeta.csModel\Common\CollectionResponse\CollectionResponse [T] .csModel\Common\CollectionResponse\ICollectionResponse [ T] .csModel\Common\Interfaces\IAPIResource.cs Model\Common\Interfaces\IAPIType.cs Model\Common\MonetaryUnit.csModel\Common \Perspective \Internal Classes \Perspective.BasicPerspective.csModel\Common \Perspective \Internal Classes\Perspective.CustomizablePerspective.csModel\Common\Perspective \Internal Classes \Perspective.LossNetOfTermsPerspective.csModel\\ \\Common\Perspective\Perspective.cs Model\Common\Perspective\Perspective.Enum.cs Model\Common\Perspective\Perspective.Static.cs Model\Common\Reference\IReference.cs Model\Common\Reference\IReference [T] .csModel\Common\Reference\Reference.csModel\Common\Reference\Reference [T] .csModel\Common \Reinstatement.cs Model\Common\TaskStatus.cs Model\Metrics\BackAllocations\BackAllocations.cs Model\Metrics\CoMetrics\CoMetrics.Context.cs Model\Metrics\CoMetrics\CoMetrics .cs Model\Metrics\ExceedanceProbabilities\ExceedanceProbability.Context.cs Model\Metrics\ExceedanceProbabilities\ExceedanceProbability.cs Model\Metrics\TailMetrics\TailMetrics.Context.cs Model\Metrics\TailMetrics\\ \\ TailMetrics.cs Model\Resources\Agent.cs Model\Resources\AnalysisProfile.csModel\Resources\Analysis\Abstract Base Classes\Analysis.csModel\Resources\Analysis \ VendorPortfolioAnalysis.cs Model\Resources\Analysis\VendorTreatyAnalysis.csModel\Resources\ Distributed \Abstract Base Classes\ContinuousDistribution.csModel\Resources \Distributions\Abstract Base Classes\ CustomizedDistribution .csModel\Resources \Distributions \Abstract Base Classes\DiscreteDistribution.csModel\Resources \Distributions\Abstract Base Classes\Distribution.csModel\Resources\Distributions\ BinomialDistribution.cs模型\Resources \Distributions \CustomFrequencyDistribution.cs模型\Resources \Distributions \CustomSeasonalityDistribution.cs模型\Resources \Distributions \CustomSeverityDistribution.cs模型\Resources \分布\DiracDistribution。 cs Model\Resources\Distributions\LogNormalDistribution.cs Model\Resources\ Distributed \ NegativeBinomialDistribution.cs Model\Resources \ Distributed \NormalDistribution.cs Model\Resources \Distributions\ParetoDistribution.cs Model \Resources \Distributions\PoissonDistribution.cs Model\Resources \Distributions\UniformDistribution.cs Model\Resources \Distributions\UniformIntDistribution.cs Model\Resources\EventCatalog.cs Model\Resources\ ExchangeRateProfile\ExchangeRateProfile.csModel\Resources\ExchangeRateProfile\Internal Classes\ExchangeRateProfile.ExchangeRateDateRule.csModel\Resources\ExchangeRateProfile \Internal Classes\ExchangeRateProfile.ExchangeRateLatestRule.csModel\ Resources\ExchangeRateProfile\Internal Classes\ExchangeRateProfile.ExchangeRateSelectionRule.csModel\Resources\ExchangeRateTable.cs Model\Resources\File.csModel\Resources\Layers\Abstract Base Classes\Layer .csModel\Resources\Layers\Abstract Base Classes\Layer_WithLossSets.csModel\Resources\Layers\Abstract Base Classes\Layer_WithTerms.csModel\Resources\Layers\\ \\Abstract Base Classes\Layer_XL.csModel\Resources\Layers\AggregateQuotaShare.cs Model\Resources\Layers\AggXL.cs Model\Resources\Layers\CatXL.cs Model\Resources \Layers\Filter.cs Model\Resources\Layers\Generic.cs Model\Resources\Layers\IndustryLossWarranty.cs Model\Resources\Layers\Interfaces\ILayer.cs Model\资源\Layers\Interfaces\ILayer_WithAggregateTerms.cs模型\Resources\Layers\Interfaces\ILayer_WithLossSets.cs模型\Resources\Layers\Interfaces\ILayer_WithOccurrenceTerms.cs模型\Resources\Layers\\ \\Interfaces\ILayer_WithReinstatements.cs Model\Resources\Layers\Interfaces\ILayer_WithTerms.cs Model\Resources\Layers\Nested.cs Model\Resources\Layers\QuotaShare.cs Model\Resources \Layers\SurplusShare.cs Model\Resources\LayerViews\ILayerView.csModel\Resources\LayerViews\ILayerView [T] .csModel\Resources\LayerViews\LayerViews.cs Model\Resources\LayerViews\LayerView [T] .csModel\Resources\LossFilters\Abstract Base Classes\AttributeFilter.csModel\Resources\LossFilters\Abstract Base Classes\ ComparisonFilter.csModel\Resources\LossFilters\Abstract Base Classes\ExpressionFilter.csModel\Resources\LossFilters\Abstract Base Classes\LossFilter.csModel\Resources\LossFilters\\ \\AndFilter.cs Model\Resources\LossFilters\AnyFilter.cs Model\Resources\LossFilters\AnyOfFilter.cs Model\Resources\LossFilters\GTFilter.cs Model\Resources\LossFilters\LTFilter .cs Model\Resources\LossFilters\OrFilter.cs Model\Resources\LossFilters\RangeFilter.csModel\Resources\LossSets\Abstract Base Classes\LossSet.csModel\Resources \LossSets\Abstract Base Classes\LossSet_WithCurrency.csModel\Resources\LossSets\Abstract Base Classes\LossSet_WithData.csModel\Resources\LossSets\ELTLossSet.cs Model\Resources\\ \\LossSets\Interfaces\ILossSet_Simulated.cs Model\Resources\LossSets\Interfaces\ILossSet_WithEventCatalog.cs Model\Resources\LossSets\Interfaces\ILossSet_WithSeasonality.csModel\Resources\LossSets\内部类\BinaryYELTConverter.csModel\Resources\LossSets\Internal Classes\InuringTerms.csModel\Resources\LossSets\Internal Classes\LossSetProfile.csModel\Resources\\ \\ LossSets \Internal Classes\LossType.csModel\Resources\LossSets\Internal Classes\NestedLayerLossSet.Perspective.csModel\Resources\LossSets\ Internal Classes \TreatyLossSet.Treaty。 csModel\Resources\LossSets\LoadedLossSet.cs Model\Resources\LossSets\NestedLayerLossSet.cs Model\Resources\LossSets\ParametricLossSet.cs Model\Resources\LossSets\PortfolioLossSet.cs Model\Resources\LossSets\TreatyLossSet.cs Model\Resources\LossSets\YELTLossSet.cs Model\Resources\LossSets\YLTLossSet.csModel\Resources\OptimizationView\Internal Classes\ OptimizationView.Candidate.csModel\Resources\OptimizationView\ Internal Classes \OptimizationView.CandidateParameter.csModel\Resources \OptimizationView \Internal Classes\OptimizationView.DomainEntry.csModel\\ Resources\OptimizationView\ Internal Classes\OptimizationView.Result.csModel\Resources\OptimizationView\OptimizationView.csModel\Resources\Portfolios\Abstract Base Classes\Portfolio.csModel\ Resources\Portfolios\DynamicPortfolio.cs Model\Resources\Portfolios\StaticPortfolio.cs Model\Resources\PortfolioView\PortfolioView.cs Model\Resources\Simulation\Simulation.cs Model\Resources\\ \\ Simulation \StaticSimulation.cs实用程序\Formatting.cs实用程序\IfNotNullExtensionMethod.cs实用程序\ReflectionUtilities.cs实用程序\模拟监视器\AsyncRequestMonitor.cs实用程序\模拟监视器\SimulationStatus.cs实用程序\Simulation Monitor\SimulationStatusMonitor.csUtilities \TypeResolver.cs属性\AssemblyInfo.cs属性\Settings.Designer.csC:\ Temp \.NETFramework,Version = v4.5.AssemblyAttributes。 cs
09:48:23 API\API.Configuration.cs(9,20):错误CS0246:无法找到类型或命名空间名称
'RestSharp'(是否缺少一个使用指令或程序集引用?)
...
09:48:23 API\ExtensionMethods.IAPIType.cs(2,7):错误CS0246:类型或命名空间名称
'找不到Newtonsoft'(你缺少一个using指令或程序集引用吗?)
...
09:48:25 0警告
09:48:25 258错误
09:48:25
09:48:25已用时间00:00:01.27

这是我的构建脚本:

  nuget.exe更新-Self 
nuget.exe还原Client.sln
MSBuild.exe Client.sln / p:Configuration = Release

在切换到恢复解决方案的packages.json方法之前从未遇到过问题(这需要从csproj文件中删除引用



可以告诉,NuGet引用的dll没有链接到生成(他们不会出现在真正长的 CoreCompile 行的任何地方)。

$ b $

解决方案

是否需要更改CI构建脚本中的内容以使其再次工作?为了使MSBuild从project.json文件解析程序集,它使用自定义MSBuild任务



在您的本地计算机上,这些将位于以下目录中:

  C:\Program Files(x86)\MSBuild\Microsoft\NuGet 

我相信这些文件是由Visual Studio 2015安装的。



还有一个 Microsoft.NuGet.ImportBefore.props 文件:

  C:\Program Files(x86)\MSBuild\14.0\ Imports \Microsoft.Common.Props\ImportBefore 

还有一个 Microsoft.NuGet

\\ 14.0 \Imports\Microsoft.Common.Targets\ImportAfter

这是NuGet的工作原理。 props和.targets文件导入到MSBuild并提供给每个项目。


I've recently switched to NuGet's latest recommended method which is using a `packages.json' file for projects:

{
  "dependencies": {
    "Newtonsoft.Json": "9.0.1",
    "RestSharpSigned": "105.2.3"
  },
  "frameworks": {
    "net45": {}
  },
  "runtimes": {
    "win": {}
  }
}

This works great in my local visual studio environment, but the CI server can no longer build the project.

What's odd is that I can see the packages being successfully restored for the solution, but on build, MSBuild has no idea where those DLLs are and all references to them fail:

Package Restore Succeeding:

09:48:07 Updating NuGet.exe to 3.4.4-rtm-final.
09:48:07 Update successful.
09:48:08 MSBuild auto-detection: using msbuild version '14.0' from 
         'C:\Program Files (x86)\MSBuild\14.0\bin'.
09:48:09 Restoring packages for C:\jenkins-test\...\Client\Client.NET45.project.json...
09:48:10 Installing RestSharpSigned 105.2.3.
09:48:10 Installing Newtonsoft.Json 9.0.1.
09:48:13 Committing restore...
09:48:13 Committing restore...
09:48:13 C:\jenkins-test\...\Client\Client.NET45.csproj
09:48:13 Restore completed in 3715ms.09:48:13 Installed:
09:48:13     2 package(s) to C:\jenkins-test\...\Client\Client.NET45.csproj

Build Failing:

09:48:14 Microsoft (R) Build Engine version 14.0.23107.0
...
09:48:14 Project "C:\jenkins-test\...\Client.sln" (1) is building 
         "C:\jenkins-test\...\Client\Client.NET45.csproj" (2) on node 1 (default targets).
09:48:14 PrepareForBuild:
09:48:14   Creating directory "bin\Debug\net45\".
09:48:14   Creating directory "obj\Debug\".
09:48:14 CoreCompile:
09:48:14   C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /doc:bin\Debug\net45\Client.xml /define:DEBUG;TRACE;NET45 /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsBase.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Client.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /target:library /utf8output API\API.Authentication.cs API\API.Configuration.cs API\API.Parameters.cs API\API.Requests.cs API\API.Utilities.cs API\Authentication\AccessTokenStatus.cs API\Authentication\AuthenticationStatus.cs API\Authentication\BasicAuthenticationToken.cs API\Authentication\IAccessToken.cs API\Authentication\OauthAccessToken.cs "API\Custom Exceptions\APIRequestException.cs" "API\Custom Exceptions\NotWaitingException.cs" API\ExtensionMethods\ExtensionMethods.IAPIResourceView.cs API\ExtensionMethods\ExtensionMethods.IAPIResource_WithDataEndpoint.cs API\ExtensionMethods\ExtensionMethods.IAPIType.cs API\ExtensionMethods\ExtensionMethods.Reference.cs API\ExtensionMethods\ExtensionMethods.Rest.cs API\ExtensionMethods\ExtensionMethods.Rest.InferredType.cs API\JsonConverters\AnalyzeReContractResolver.cs API\JsonConverters\AnalyzeReJsonConverter.cs API\JsonConverters\ComplexNestedObjectConverter.cs API\JsonConverters\DerivedResourceCreationConverter.cs API\JsonConverters\JsonCreationConverter.cs "API\JsonConverters\JsonCreationConverter[T].cs" API\JsonConverters\JsonSerializerExtensionMethods.cs API\JsonConverters\LayerViewCreationConverter.cs API\JsonConverters\PortfolioViewSerializer.cs API\JsonConverters\ReferenceConverter.cs API\JsonConverters\UriConverter.cs API\LargeDataUpload\AdaptiveBufferedBytesProducer.cs API\LargeDataUpload\BufferedBytes.cs API\LargeDataUpload\BufferedBytesFromStreamProducer.cs API\LargeDataUpload\BufferedBytesResizer.cs API\LargeDataUpload\BufferedBytesToStringProducer.cs API\LargeDataUpload\BufferProducerException.cs API\LargeDataUpload\GZipBufferedBytesProducer.cs "API\LargeDataUpload\Internal Classes\LargeDataUpload.AsyncParameters.cs" "API\LargeDataUpload\Internal Classes\LargeDataUpload.Exceptions.cs" "API\LargeDataUpload\Internal Classes\LargeDataUpload.HandleUploadInSessionStrategy.cs" "API\LargeDataUpload\Internal Classes\LargeDataUpload.Parameters.cs" "API\LargeDataUpload\Internal Classes\LargeDataUpload.StatusReponse.cs" API\LargeDataUpload\IProducerConsumerBuffer.cs API\LargeDataUpload\LargeDataUpload.cs API\LargeDataUpload\ProducerConsumerBuffer.cs API\Rest\IRestResponse.cs API\Rest\Method.cs API\Rest\Parameter.cs API\Rest\ParameterType.cs API\Rest\ResponseStatus.cs API\Rest\RestResponse.cs "API\Rest\RestResponse[T].cs" Attributes\APITypeAliasAttribute.cs Attributes\GreaterThanAttribute.cs Attributes\LessThanAttribute.cs Attributes\NotEmptyAttribute.cs Attributes\NotNullAttribute.cs Attributes\NumericValidationAttribute.cs Attributes\PropertyAlias.cs Attributes\ResolvedInViews.cs Attributes\ServerGenerated.cs Attributes\ServerHasDefault.cs Attributes\ServerHasDefaultEmptyObject.cs Attributes\ValidationAttribute.cs Model\APITypes\APIResource_WithDataEndpoint.cs Model\APITypes\APIType_Polymorphic.cs Model\APITypes\Interfaces\IAPIResource_WithDataEndpoint.cs Model\APITypes\Interfaces\IAPI_Polymorphic.cs Model\APITypes\Interfaces\IStoredAPIResource.cs Model\APITypes\OptionsResponse.cs "Model\APITypes\REST Entities\ResourceStringBuilder.cs" "Model\APITypes\REST Entities\SubResources\CommandSubResource.cs" "Model\APITypes\REST Entities\SubResources\DataSubResource.cs" "Model\APITypes\REST Entities\SubResources\LargeDataSubResource.cs" "Model\APITypes\REST Entities\SubResources\ResourceEndpoint.cs" "Model\APITypes\REST Entities\SubResources\SubResource[T].cs" Model\APITypes\ServerError.cs Model\APITypes\StoredAPIResource.cs Model\APITypes\StoredAPIResource_Polymorphic.cs Model\Common\APIResource.cs Model\Common\APIResourceView\AggregationMethod.cs Model\Common\APIResourceView\BaseAPIResourceView.BackAllocations.cs Model\Common\APIResourceView\BaseAPIResourceView.CoMetrics.cs Model\Common\APIResourceView\BaseAPIResourceView.cs Model\Common\APIResourceView\BaseAPIResourceView.ExceedanceProbabilities.cs Model\Common\APIResourceView\BaseAPIResourceView.TailMetrics.cs Model\Common\APIResourceView\IAPIResourceView.cs Model\Common\APIResourceView\State.cs Model\Common\APIResourceView\TargetCurrencyDefault.cs Model\Common\APIResourceView\YELTSimulationResult.cs Model\Common\APIResourceView\YLTSimulationResult.cs Model\Common\APIType.cs Model\Common\CollectionResponse\CollectionResponseMeta.cs "Model\Common\CollectionResponse\CollectionResponse[T].cs" "Model\Common\CollectionResponse\ICollectionResponse[T].cs" Model\Common\Interfaces\IAPIResource.cs Model\Common\Interfaces\IAPIType.cs Model\Common\MonetaryUnit.cs "Model\Common\Perspective\Internal Classes\Perspective.BasicPerspective.cs" "Model\Common\Perspective\Internal Classes\Perspective.CustomizablePerspective.cs" "Model\Common\Perspective\Internal Classes\Perspective.LossNetOfTermsPerspective.cs" Model\Common\Perspective\Perspective.cs Model\Common\Perspective\Perspective.Enum.cs Model\Common\Perspective\Perspective.Static.cs Model\Common\Reference\IReference.cs "Model\Common\Reference\IReference[T].cs" Model\Common\Reference\Reference.cs "Model\Common\Reference\Reference[T].cs" Model\Common\Reinstatement.cs Model\Common\TaskStatus.cs Model\Metrics\BackAllocations\BackAllocations.cs Model\Metrics\CoMetrics\CoMetrics.Context.cs Model\Metrics\CoMetrics\CoMetrics.cs Model\Metrics\ExceedanceProbabilities\ExceedanceProbability.Context.cs Model\Metrics\ExceedanceProbabilities\ExceedanceProbability.cs Model\Metrics\TailMetrics\TailMetrics.Context.cs Model\Metrics\TailMetrics\TailMetrics.cs Model\Resources\Agent.cs Model\Resources\AnalysisProfile.cs "Model\Resources\Analysis\Abstract Base Classes\Analysis.cs" Model\Resources\Analysis\VendorPortfolioAnalysis.cs Model\Resources\Analysis\VendorTreatyAnalysis.cs "Model\Resources\Distributions\Abstract Base Classes\ContinuousDistribution.cs" "Model\Resources\Distributions\Abstract Base Classes\CustomDistribution.cs" "Model\Resources\Distributions\Abstract Base Classes\DiscreteDistribution.cs" "Model\Resources\Distributions\Abstract Base Classes\Distribution.cs" Model\Resources\Distributions\BinomialDistribution.cs Model\Resources\Distributions\CustomFrequencyDistribution.cs Model\Resources\Distributions\CustomSeasonalityDistribution.cs Model\Resources\Distributions\CustomSeverityDistribution.cs Model\Resources\Distributions\DiracDistribution.cs Model\Resources\Distributions\LogNormalDistribution.cs Model\Resources\Distributions\NegativeBinomialDistribution.cs Model\Resources\Distributions\NormalDistribution.cs Model\Resources\Distributions\ParetoDistribution.cs Model\Resources\Distributions\PoissonDistribution.cs Model\Resources\Distributions\UniformDistribution.cs Model\Resources\Distributions\UniformIntDistribution.cs Model\Resources\EventCatalog.cs Model\Resources\ExchangeRateProfile\ExchangeRateProfile.cs "Model\Resources\ExchangeRateProfile\Internal Classes\ExchangeRateProfile.ExchangeRateDateRule.cs" "Model\Resources\ExchangeRateProfile\Internal Classes\ExchangeRateProfile.ExchangeRateLatestRule.cs" "Model\Resources\ExchangeRateProfile\Internal Classes\ExchangeRateProfile.ExchangeRateSelectionRule.cs" Model\Resources\ExchangeRateTable.cs Model\Resources\File.cs "Model\Resources\Layers\Abstract Base Classes\Layer.cs" "Model\Resources\Layers\Abstract Base Classes\Layer_WithLossSets.cs" "Model\Resources\Layers\Abstract Base Classes\Layer_WithTerms.cs" "Model\Resources\Layers\Abstract Base Classes\Layer_XL.cs" Model\Resources\Layers\AggregateQuotaShare.cs Model\Resources\Layers\AggXL.cs Model\Resources\Layers\CatXL.cs Model\Resources\Layers\Filter.cs Model\Resources\Layers\Generic.cs Model\Resources\Layers\IndustryLossWarranty.cs Model\Resources\Layers\Interfaces\ILayer.cs Model\Resources\Layers\Interfaces\ILayer_WithAggregateTerms.cs Model\Resources\Layers\Interfaces\ILayer_WithLossSets.cs Model\Resources\Layers\Interfaces\ILayer_WithOccurrenceTerms.cs Model\Resources\Layers\Interfaces\ILayer_WithReinstatements.cs Model\Resources\Layers\Interfaces\ILayer_WithTerms.cs Model\Resources\Layers\Nested.cs Model\Resources\Layers\QuotaShare.cs Model\Resources\Layers\SurplusShare.cs Model\Resources\LayerViews\ILayerView.cs "Model\Resources\LayerViews\ILayerView[T].cs" Model\Resources\LayerViews\LayerViews.cs "Model\Resources\LayerViews\LayerView[T].cs" "Model\Resources\LossFilters\Abstract Base Classes\AttributeFilter.cs" "Model\Resources\LossFilters\Abstract Base Classes\ComparisonFilter.cs" "Model\Resources\LossFilters\Abstract Base Classes\ExpressionFilter.cs" "Model\Resources\LossFilters\Abstract Base Classes\LossFilter.cs" Model\Resources\LossFilters\AndFilter.cs Model\Resources\LossFilters\AnyFilter.cs Model\Resources\LossFilters\AnyOfFilter.cs Model\Resources\LossFilters\GTFilter.cs Model\Resources\LossFilters\LTFilter.cs Model\Resources\LossFilters\OrFilter.cs Model\Resources\LossFilters\RangeFilter.cs "Model\Resources\LossSets\Abstract Base Classes\LossSet.cs" "Model\Resources\LossSets\Abstract Base Classes\LossSet_WithCurrency.cs" "Model\Resources\LossSets\Abstract Base Classes\LossSet_WithData.cs" Model\Resources\LossSets\ELTLossSet.cs Model\Resources\LossSets\Interfaces\ILossSet_Simulated.cs Model\Resources\LossSets\Interfaces\ILossSet_WithEventCatalog.cs Model\Resources\LossSets\Interfaces\ILossSet_WithSeasonality.cs "Model\Resources\LossSets\Internal Classes\BinaryYELTConverter.cs" "Model\Resources\LossSets\Internal Classes\InuringTerms.cs" "Model\Resources\LossSets\Internal Classes\LossSetProfile.cs" "Model\Resources\LossSets\Internal Classes\LossType.cs" "Model\Resources\LossSets\Internal Classes\NestedLayerLossSet.Perspective.cs" "Model\Resources\LossSets\Internal Classes\TreatyLossSet.Treaty.cs" Model\Resources\LossSets\LoadedLossSet.cs Model\Resources\LossSets\NestedLayerLossSet.cs Model\Resources\LossSets\ParametricLossSet.cs Model\Resources\LossSets\PortfolioLossSet.cs Model\Resources\LossSets\TreatyLossSet.cs Model\Resources\LossSets\YELTLossSet.cs Model\Resources\LossSets\YLTLossSet.cs "Model\Resources\OptimizationView\Internal Classes\OptimizationView.Candidate.cs" "Model\Resources\OptimizationView\Internal Classes\OptimizationView.CandidateParameter.cs" "Model\Resources\OptimizationView\Internal Classes\OptimizationView.DomainEntry.cs" "Model\Resources\OptimizationView\Internal Classes\OptimizationView.Result.cs" Model\Resources\OptimizationView\OptimizationView.cs "Model\Resources\Portfolios\Abstract Base Classes\Portfolio.cs" Model\Resources\Portfolios\DynamicPortfolio.cs Model\Resources\Portfolios\StaticPortfolio.cs Model\Resources\PortfolioView\PortfolioView.cs Model\Resources\Simulation\Simulation.cs Model\Resources\Simulation\StaticSimulation.cs Utilities\Formatting.cs Utilities\IfNotNullExtensionMethod.cs Utilities\ReflectionUtilities.cs "Utilities\Simulation Monitor\AsyncRequestMonitor.cs" "Utilities\Simulation Monitor\SimulationStatus.cs" "Utilities\Simulation Monitor\SimulationStatusMonitor.cs" Utilities\TypeResolver.cs Properties\AssemblyInfo.cs Properties\Settings.Designer.cs "C:\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
09:48:23 API\API.Configuration.cs(9,20): error CS0246: The type or namespace name
'RestSharp' could not be found (are you missing a using directive or an assembly reference?)
...
09:48:23 API\ExtensionMethods.IAPIType.cs(2,7): error CS0246: The type or namespace name
'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
...
09:48:25     0 Warning(s)
09:48:25     258 Error(s)
09:48:25 
09:48:25 Time Elapsed 00:00:01.27

This is my build script right now:

nuget.exe update -Self
nuget.exe restore Client.sln
MSBuild.exe Client.sln /p:Configuration=Release

Never had problems with it before switching to the packages.json method of restoring solutions (which requires removing the references from the csproj files)

From what I can tell, the referenced dlls from NuGet are not getting linked into the build (they don't appear anywhere in the really long CoreCompile line).

Do I need to change something in my CI build script to get it working again?

解决方案

In order for MSBuild to resolve the assemblies from the project.json file it uses a custom MSBuild task which is installed on the machine so it is globally available for MSBuild.

On your local machine these will be in the directory:

C:\Program Files (x86)\MSBuild\Microsoft\NuGet

I believe these files are installed by Visual Studio 2015.

There is also a Microsoft.NuGet.ImportBefore.props file in the directory:

C:\Program Files (x86)\MSBuild\14.0\Imports\Microsoft.Common.Props\ImportBefore

There is also a Microsoft.NuGet.ImportAfter.targets file in the directory:

C:\Program Files (x86)\MSBuild\14.0\Imports\Microsoft.Common.Targets\ImportAfter

Which is how the NuGet .props and .targets files are imported into MSBuild and made available to every project.

这篇关于NuGet软件包还原失败(仅在命令行上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆