【发布时间】:2018-07-21 14:01:15
【问题描述】:
我正在使用 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>
请告诉我需要哪些其他信息来帮助解决此问题。
【问题讨论】:
-
您的项目中是否直接引用了
System.Web.Helpers?如果没有,您可以通过将其添加为具有复制本地 true 的程序集引用来使其工作 -
@ThePretendProgrammer 感谢您的想法。它被引用,并且它设置为复制本地true。
标签: visual-studio tfs nuget