2

我最近在使用 TeamCity Build Agent 时遇到了一些问题。我开始在构建机器上用完空间,所以我选择删除一些旧的 Visual Studio (2013) 实例,并切换到仅使用 Visual Studio 2017 构建工具(其中包括卸载之前完整安装的 VS2017 Enterprise当下)。我认为由于这个过程,一些重要的构建组件已被无意中删除,但我不清楚它们到底是什么。我的项目使用 NuGet 包的组合,其中包括 NETStandard 库 v1.3 和一些 4.6.1 框架的 .NET 库。我得到的构建错误只发生在我的库上,它们都是 netstandard1.3 可移植库,它们都读取:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\
bin\Microsoft.Common.CurrentVersion.targets(1122, 5): error MSB3644: 
The reference assemblies for framework ".NETPortable,Version=v5.0" were not found. 
To resolve this, install the SDK or Targeting Pack for this framework version
or retarget your application to a version of the framework for which you have the SDK
or Targeting Pack installed. 
Note that assemblies will be resolved from the Global Assembly Cache (GAC)
and will be used in place of reference assemblies. 
Therefore your assembly may not be correctly targeted for the framework you intend

以前这些项目在这台服务器上构建得很好,所以我假设任何符合 .NETPortable,Version=v5.0 库的内容都已被删除。我如何让他们回来?从我可以看到的构建工具中,我已经安装了所有可用的功能、netcore、所有框架,但它仍然不起作用。任何建议都将受到欢迎。

4

1 回答 1

0

为了让我解决这个问题,我尝试了一些我将在这里列出的事情,然后告诉你我的假设。

  1. 运行 MS Build 工具的修复(VS2017)
  2. 再次尝试安装 VS2013(见下文原因)
  3. 将我的项目从旧的 PCL 样式项目格式转换为官方的 .netstandard 项目类型。

我的怀疑是 MS 构建工具没有损坏,尽管阅读各种论坛表明 VS2013 可能具有支持 PCL 的较旧目标,这些目标不再原生包含在 VS2017 中。我尝试重新安装它,但它没有帮助,所以我认为最终的解决方案就像转换为官方 netstandard 项目(从遗留 PCL 项目类型)一样简单,一切都开始重新构建。

无论出于何种原因,我发现我必须随后切换到使用新的 MSTest NuGet 包才能让我的测试再次工作。

于 2017-11-28T11:37:42.970 回答