Build fails on System.AppContext from assembly 'mscorlib

I have a build that is failing with the following message

Unhandled Exception: System.TypeLoadException: Could not load type 'System.AppContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at NuGet.CommandLine.Program.Main(String[] args)
 
I've been searching for the best part of 2 days trying to find a resolution but to no avail. I can't even find posts that are close to this error. So can anyone please tell me what this means and how to resolve it.
Possible important information:
TeamCity Ver 2019.1, Project Framework:4.5, Visual Studio 2017, TC running on Windows Server 2012 R2 w/ Framework 4.5 installed. 
Thanks in advance.
Gary
0
1 comment

Hi Gary,

 

the "Could not load type 'System.*'" errors usually mean that the user running the build agent doesn't have proper access to the framework SDK (or the SDK itself is not properly installed). You mention that you are using Visual Studio 2017 and have the framework 4.5 installed, but is VS 2017 installed on the build agent or is it just the build runner you are using? You are going to need the SDK to be installed in order to be able to use those libraries, and installing VS 2017 usually installs it, so it's relevant to understand what you meant with that.

0

Please sign in to leave a comment.