Recently, I got below error while publishing the VS project
Microsoft (R) Visual C# Compiler version 4.8.3761.0 for C# 5 Copyright (C) Microsoft Corporation. All rights reserved. This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version.
Fix - I have to delete the VS publishing profile and that fixed the issue.