Visual Studio 在线(2015 版)中缺少包的构建错误

Build errors of missing packages in Visual Studio Online (2015 version)

当我在签入 Visual Studio Online 时触发构建时收到以下消息。它在本地编译和部署都很好。

packages\Microsoft.Net.Compilers.1.0.0\tools\Microsoft.CSharp.Core.targets (67, 5)

更准确地说,这就是所描述的问题。

The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\a\s\packages\Microsoft.Net.Compilers.1.0.0\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'file:///C:\a\s\packages\Microsoft.Net.Compilers.1.0.0\tools\Microsoft.Build.Tasks.CodeAnalysis.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

所以,很明显,我有一些本地放置的文件使编译工作在现场(即我的机器),但这些文件不是使用签入部署的。我没有手动将任何 DLL 或类似内容放入我的项目中。那里的一切都是基于源代码或通过包管理器获得的。

这会带来以下问题。

  1. 我不知道具体是哪些文件(Visual Studio Online 中的错误消息没有透露该信息,我无法在本地复制)。
  2. 我不确定如何强制将所有相关文件推送到存储库以供构建代理获取(根据我的经验,它是自动完成的)。

构建步骤中的设置如下。

此问题通常发生在将 nuget 包签入版本控制时。删除版本控制中的包文件夹,并确保 "packages.config" 文件已签入版本控制。然后排队新构建。

事实证明,NuGet 包已提交到存储库并破坏了所有内容。从 repo 中删除 project\project\packages 目录解决了所有构建问题,因为 NuGet 在构建时自动获取包。

我更新到最新版本的软件包,问题已解决

我已经清除了构建中的 Packages 文件夹并为我修复了它。