continuous-integration - VSTS NuGet 步骤恢复错误 : You cannot call a method on a null-valued expression at CallSite. 目标(Closure、CallSite、Object、Object)

标签 continuous-integration nuget nuget-package azure-devops nuget-package-restore

我在 Visual Studio Team Services(以前是 Visual Studio Online)中执行 NuGet 恢复步骤时遇到错误。我没有设置什么特别的,但出现了错误。错误是:

2016-04-10T16:53:36.3476846Z ##[debug]Adding credentials section to NuGet.config
2016-04-10T16:53:36.5691737Z ##[error]System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
2016-04-10T16:53:36.5701787Z ##[error] at CallSite.Target(Closure , CallSite , Object , Object )
2016-04-10T16:53:36.5711737Z ##[error] at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
2016-04-10T16:53:36.5721738Z ##[error] at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
2016-04-10T16:53:36.5721738Z ##[error] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

这里有所有详细信息。在几张屏幕截图的开头:

Configuration Bild Step in VSO
Logs from output console in VSO

我的主要 nuget 配置文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<repositories>
  <repository path="..\Aleksandra.Tests\packages.config" />
  <repository path="..\Aleksandra\packages.config" />
</repositories>

接下来的子配置如下所示:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.4.1.9004" targetFramework="net45" />
  <package id="bootstrap" version="3.0.0" targetFramework="net45" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net45" />
  <package id="jQuery" version="1.10.2" targetFramework="net45" />
  <package id="jQuery.Validation" version="1.11.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="Modernizr" version="2.6.2" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
  <package id="Owin" version="1.0" targetFramework="net45" />
  <package id="Respond" version="1.2.0" targetFramework="net45" />
  <package id="WebGrease" version="1.5.2" targetFramework="net45" />
</packages>

…和..

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
</packages>

最佳答案

看看this关于包恢复的文章。引用要点,repositores.config 文件将在需要时自动重新生成。这同样适用于 packages 文件夹。您可以安全地将它们从源代码管理中删除。

此外,您可以将NuGet.config 的路径文本框留空。除非您有特殊需求(例如需要身份验证的私有(private)源),否则您不需要该文件,所有 packages.config 文件都将在解决方案中选取。

关于continuous-integration - VSTS NuGet 步骤恢复错误 : You cannot call a method on a null-valued expression at CallSite. 目标(Closure、CallSite、Object、Object),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36533173/

相关文章:

amazon-web-services - 将现有 CodePipeline/CodeBuild 项目导出到 Cloudformation

python - Pipenv锁: how to cache downloads for transfer to an offline machine

git - Travis-CI:将不同的分支部署到不同的服务器

msbuild - 来自 TeamCity 的 MSBuild 的/P MSDeploy 参数的完整列表

c# - 自发布包中的build文件夹中的文件不被第三方项目消耗

未安装 Nuget 依赖项

nuget - 在 nuget 还原包中构建 C# 项目失败 Microsoft.ApplicationInsights

redis - ServiceStack Redis 客户端期望旧版本的 ServiceStack.Common

c# - 如何连接MySQL数据库?

teamcity - 在 TeamCity 中设置 Nuget 包版本号