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): 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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With