CS0012 System.enum is defined in an assembly that is not related to targeting the .NET 4.5 assembly server

I have an ASP.NET web application oriented to .NET 4.5. The project is being built locally, but on the build server (TeamCity) it fails:

... cs (77, 38): error CS0012: The type "System.Enum" is defined in an assembly that is not referenced. You must add a reference to the assembly 'System.Runtime, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a ".

What could be the reason (and fix) for this?

+7
source share
2 answers

I had the 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.

If you are using Windows Server 2012 for targeting platform 4.5 and the build server, be sure to add the .NET Framework 4.5. Features of using Server Manager. If TeamCity is installed on a previous version of Windows, check out the Microsoft .NET Framework Guide.

+7
source share

The problem was that Team City was configured to use "Visual Studio 2013" at the build stage, while our project uses "Visual Studio 2012".

+2
source share

All Articles