[英]CS0012 System.enum is defined in an assembly not referenced on build server targeting .NET 4.5
I have an ASP.NET web application targeting .NET 4.5. 我有一个针对.NET 4.5的ASP.NET Web应用程序。 Locally, the project builds, but on the build server (TeamCity) it fails: 在本地,项目构建,但在构建服务器(TeamCity)上它失败:
...cs(77, 38): error CS0012: The type 'System.Enum' is defined in an assembly that is not referenced. ... cs(77,38):错误CS0012:类型'System.Enum'在未引用的程序集中定义。 You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 您必须添加对程序集'System.Runtime,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'的引用。
What can be the cause of (and remedy for) this? 这可能是什么原因(和补救措施)?
I had the very same error message (although targeting framework 4.5.1). 我有相同的错误消息(虽然目标框架4.5.1)。 The answer for me was to install the Microsoft .NET Framework 4.5.1 Developer Pack on the build server. 我的答案是在构建服务器上安装Microsoft .NET Framework 4.5.1 Developer Pack 。
If targeting framework 4.5 and the build server is running Windows Server 2012, be sure to add the .NET Framework 4.5. 如果目标框架4.5和构建服务器运行的是Windows Server 2012,请确保添加.NET Framework 4.5。 Features using Server Manager. 功能使用Server Manager。 If TeamCity is installed on a previous version of Windows, check out the Microsoft .NET Framework installation guide . 如果TeamCity安装在以前版本的Windows上,请查看Microsoft .NET Framework安装指南 。
问题是Team City设置为在构建步骤中使用“Visual Studio 2013”,而我们的项目使用“Visual Studio 2012”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.