I have an MVC project that for an uknown reason refuses to publish to a local folder in the PC.
The log says the following:
3>------ Publish start
Sorry for reopening the thread, but for me Cleaning the solution worked on .NET.Compilers v2.7 (Visual Studio 2015).
Try removing the Microsoft.Net.Compilers Nuget package.
I had tried a lot of things, none successful. I did this and the publishing succeeded. To be sure, I restored my project from BitBucket to its original condition, tested to see the publishing failed, removed the nuget package again, and it worked.
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.)
downgrade "Microsoft.Net.Compilers" from v2.9.0 to v2.4.0 works like a charm
I had switched to C# 7.3 in Properties > Build > Advanced, but accidentally only did so for the Debug configuration. When publishing (using Release configuration) it was still using C# 7.0, which lacked some of the language features I had used.
Errors weren't visible in the Error List pane, only in the Output pane.
Setting the language version to C# 7.3 for "All Configurations" solved it for me.
This was using current version of Visual Studio 2017, Microsoft.Net.Compilers package not included in project.
First, select the mode (Debug or Release). Then right click on the solution/project then select Clean. Then choose Rebuild. Then Publish.