VSTS NuGet步骤恢复错误:您无法在CallSite.Target(Closure,CallSite,Object,Object)上调用空值表达式上的方法

时间:2016-04-10 17:37:04

标签: 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]将凭据部分添加到NuGet.config
  2016-04-10T16:53:36.5691737Z ## [错误] System.Management.Automation.RuntimeException:您无法在空值表达式上调用方法。
      2016-04-10T16:53:36.5701787Z ## [错误]在CallSite.Target(Closure,CallSite,Object,Object)
      2016-04-10T16:53:36.5711737Z ## [错误]在System.Dynamic.UpdateDelegates.UpdateAndExecute2 [T0,T1,TRet](CallSite站点,T0 arg0,T1 arg1)
      2016-04-10T16:53:36.5721738Z ## [错误]在System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
      2016-04-10T16:53:36.5721738Z ## [错误]在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>

1 个答案:

答案 0 :(得分:3)

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

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