TFS没有解析AspNet Nuget包

时间:2018-02-11 06:14:43

标签: visual-studio tfs nuget

我在visualstudio.com上使用在线TFS。我的解决方案在我的本地计算机上没有任何问题。

构建设置为恢复nuget包。由于某种原因,它会恢复除Microsoft.AspNet.Mvc包之外的所有必需包。

其他包也可以,例如:

2018-02-11T05:35:17.0087836Z Restoring NuGet package Microsoft.Web.Infrastructure.1.0.0.

TFS执行以下命令来恢复nuget包:

2018-02-11T05:34:13.9983013Z Saving NuGet.config to a temporary config file.
2018-02-11T05:34:14.0034492Z [command]D:\a\_tool\NuGet\4.3.0\x64\nuget.exe sources Add -NonInteractive -Name NuGetOrg -Source https://api.nuget.org/v3/index.json -ConfigFile D:\a\1\Nuget\tempNuGet_23.config
2018-02-11T05:34:19.0878753Z Package Source with Name: NuGetOrg added successfully.
2018-02-11T05:34:19.0887956Z Saving NuGet.config to a temporary config file.
2018-02-11T05:34:19.0987326Z [command]D:\a\_tool\NuGet\4.3.0\x64\nuget.exe restore D:\a\1\s\BFT\BFT\BFT.sln -Verbosity Detailed -NonInteractive -ConfigFile D:\a\1\Nuget\tempNuGet_23.config
2018-02-11T05:35:17.0078970Z NuGet Version: 4.3.0.4406
2018-02-11T05:35:17.0079582Z MSBuild auto-detection: using msbuild version '15.5.180.51428' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.

当到达与mvc相关的二进制文件时,日志会出现以下错误:

Primary reference "System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL".
2018-02-11T05:36:10.4565719Z ##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2041,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

项目的packages.config包含参考:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <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.Bcl.Build" version="1.0.21" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
</packages>

请告诉我需要哪些其他信息才能解决此问题。

1 个答案:

答案 0 :(得分:0)

似乎TFS无法解析的引用链接到要检入源代码管理的相应包文件夹。未签入的文件夹已正确解析,但未解析的文件夹。

解决方案是从源代码管理中删除/packages/下的所有文件夹,然后TFS成功解析了引用。