CS0012 System.enum在未针对.NET 4.5的构建服务器上引用的程序集中定义 [英] CS0012 System.enum is defined in an assembly not referenced on build server targeting .NET 4.5

查看:39
本文介绍了CS0012 System.enum在未针对.NET 4.5的构建服务器上引用的程序集中定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个针对.NET 4.5的ASP.NET Web应用程序.项目在本地构建,但是在构建服务器(TeamCity)上失败:

I have an ASP.NET web application targeting .NET 4.5. Locally, the project builds, but on the build server (TeamCity) it fails:

... cs(77,38):错误CS0012:类型'System.Enum'在未引用的程序集.您必须添加对程序集的引用'System.Runtime,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'.

...cs(77, 38): error CS0012: The type 'System.Enum' 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'.

这可能是什么原因(和补救措施)?

What can be the cause of (and remedy for) this?

推荐答案

我有非常相同的错误消息(尽管是针对目标框架4.5.1的).对我来说,答案是在构建服务器上安装 Microsoft .NET Framework 4.5.1开发人员包.

I had the very same error message (although targeting framework 4.5.1). The answer for me was to install the Microsoft .NET Framework 4.5.1 Developer Pack on the build server.

如果目标框架是4.5,并且构建服务器正在运行Windows Server 2012,请确保添加 .NET Framework 4.5.使用服务器管理器功能.如果TeamCity安装在早期版本的Windows上,请查看 Microsoft.NET Framework安装指南.

If targeting framework 4.5 and the build server is running Windows Server 2012, be sure to add the .NET Framework 4.5. Features using Server Manager. If TeamCity is installed on a previous version of Windows, check out the Microsoft .NET Framework installation guide.

这篇关于CS0012 System.enum在未针对.NET 4.5的构建服务器上引用的程序集中定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆