在某些机器上构建期间不会添加对 Microsoft.Bcl 修补库(System.Runtime 等)的引用

References to Microsoft.Bcl patched libraries (System.Runtime, etc) are not added during build on some machines

我们最近使用 NuGet 添加了 Microsoft.Bcl.Async 到我们的解决方案中。

这在两台机器上工作得很好。但是,在两台不同的机器上,编译的程序集缺少对 Microsoft.Bcl(System.Runtime、System.IO 等)附带的已修补 .NET 程序集的引用。所有机器 运行 Visual Studio 2015。引用在项目文件和 Visual Studio 中可见,它们只是没有被编译到程序集中(我为此编写了一个小工具,查询Assembly.GetReferencedAssemblies.

的结果

如果我 运行 在 Windows XP 上由 'broken' 计算机之一编译的二进制文件,它不起作用,因为 Microsoft.Bcl 实际上不包括在内.

我们已经尝试在新工作区中获取新副本,甚至重新安装 Visual Studio,但构建仍然失败。

编辑: 我在构建输出中发现了以下几行:

16>CSC : warning CS1685: The predefined type 'INotifyCompletion' is defined in multiple assemblies in the global alias; using definition from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
16>CSC : warning CS1685: The predefined type 'IAsyncStateMachine' is defined in multiple assemblies in the global alias; using definition from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
16>CSC : warning CS1685: The predefined type 'AsyncTaskMethodBuilder<TResult>' is defined in multiple assemblies in the global alias; using definition from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
16>CSC : warning CS1685: The predefined type 'ICriticalNotifyCompletion' is defined in multiple assemblies in the global alias; using definition from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
16>CSC : warning CS1685: The predefined type 'AsyncTaskMethodBuilder' is defined in multiple assemblies in the global alias; using definition from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

我还不太确定如何解决这个问题,所以感谢帮助,但我认为,这可能是我面临的问题。

好吧,我想问题已经自行解决了。 "Broken" 计算机 1 显然没有坏掉,或者曾经神奇地不再坏了,计算机 2 现在已经修复了,在卸载所有与 .NET 相关的东西并重新安装之后 Visual Studio。

令人失望的是,我现在无法正确诊断此问题的根源,但我只能忍受这一点。