C# – Project builds but can’t publish

asp.netasp.net-mvccvisual studiovisual-studio-2015

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 started: Project: Admin, Configuration: Release Any CPU ------
3>Connecting to D:\Deploys...
3>Project "Admin.csproj" (GatherAllFilesToPublish target(s)):
3>    Building with tools version "14.0".
3>    Target "ValidateMSBuildToolsVersion" skipped. Previously built unsuccessfully.
3>Done building project "Admin.csproj" -- FAILED.
3>
========== Build: 2 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

I haven't had a problem debugging on either release or debug config.

Best Answer

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.