Monday, January 22, 2018

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.

image

Lesson learned: You have to change the Language Version for every configuration you are using…

1 comment:

jaya prakash said...

I must thank you for the efforts you have put in spending this site. I am hoping to out the same high-grade content by you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal blog now..



digital-marketing