TFS Build Server: Error CS5001: Program does not contain a static 'Main' method suitable for an entry point
When trying to build a newly created project on our build server, it failed with the following error message:
##[error]CSC(0,0): Error CS5001: Program does not contain a static 'Main' method suitable for an entry point
I was using the new async main functionality in C# 7.1 but for a reason I didn’t understand the build server didn’t pick this up. Locally however, everything was working as expected.
The only difference I noticed that I was building on my machine with a Debug configuration whereas on the Build server a Release configuration was used. And indeed after changing my local settings to Release, my build started to fail.
Lesson learned: You have to change the Language Version for every configuration you are using…