TC无法构建单元测试项目。没有System.Runtime dll

时间:2018-03-30 14:38:30

标签: unit-testing msbuild teamcity

我正在尝试在teamcity的构建步骤中构建.sln文件

enter image description here

但我在测试项目中遇到了错误(解决方案的一部分)

error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

我该如何解决?单元测试项目没有app.config,我可以编写类似

的内容
  <assemblies>
        <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </assemblies>

项目目标框架4.6.1。我想解决办法可能是在TC服务器上有C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1System.Runtime.dll的文件夹,但我不确定。在TC服务器上,我的文件夹最高为4.5.2,本地最高为4.6.2,但在4.6.1中,我看不到dll - 仅在4.6中

更新

解决方案是安装开发包X版本并为X framework指定目标平台参数

0 个答案:

没有答案