Thursday, June 22, 2017

ASP.NET Core and EF Core: Build failed / Failed to build the project

By Steve Endow

While working in Visual Studio on an ASP.NET Core project that uses EF Core, I attempted to run Scaffold-DbContext, and received this error:


I thought that this message indicated that the scaffolding process failed.  After several minutes of research, I learned that this message means that the project build failed.  This error isn't directly related to Scaffold-DbContext--it is the result of Visual Studio's attempt to automatically build the project before performing the scaffolding operation.

I reviewed me code and found that I had a half-finished line of code that was preventing the build from completing.  I commented out the code, and the Scaffold-DbContext command ran successfully.

I later encountered a similar error when adding a controller to my project using the Add Controller feature in Visual Studio.


Same situation.  I had some unfinished code that prevented the project from building.  Once I cleaned up the code to the point where the project would build, the Add Controller process worked properly.


Steve Endow is a Microsoft MVP in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Twitter, YouTube, and Google+

http://www.precipioservices.com





No comments:

Post a Comment