Project builds but can't publish

前端 未结 12 1793
萌比男神i
萌比男神i 2020-11-29 04:03

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         


        
相关标签:
12条回答
  • 2020-11-29 04:42

    Sorry for reopening the thread, but for me Cleaning the solution worked on .NET.Compilers v2.7 (Visual Studio 2015).

    0 讨论(0)
  • 2020-11-29 04:43

    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.

    0 讨论(0)
  • 2020-11-29 04:44

    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.)

    0 讨论(0)
  • 2020-11-29 04:45

    downgrade "Microsoft.Net.Compilers" from v2.9.0 to v2.4.0 works like a charm

    0 讨论(0)
  • 2020-11-29 04:52

    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.

    0 讨论(0)
  • 2020-11-29 04:55

    First, select the mode (Debug or Release). Then right click on the solution/project then select Clean. Then choose Rebuild. Then Publish.

    0 讨论(0)
提交回复
热议问题