Project builds but can't publish
So I made it work.
The problem was the version of the "Microsoft.Net.Compilers". I downgraded from v2.6.1 to v2.4.0.
I don't know why so if someone knows it would be cool to know.
Sorry for reopening the thread, but for me Cleaning the solution worked on .NET.Compilers v2.7 (Visual Studio 2015).
downgrade "Microsoft.Net.Compilers" from v2.9.0 to v2.4.0 works like a charm
I was able to resolve my issue altogether by removing the NuGet package "Microsoft.Net.Compilers", rather than downgrade to 2.4.0.
(For quite some time, the Publish error would disappear if I simply restarted VS, but eventually that stopped working.)