Visual Studio project not being built when I build Solution from msbuild

I ran into this same issue, except the accepted answer didn't apply, as all the projects in my solution were set to build across all relevant configurations.

I ended up taking a very close look at my sln file, and noticed a pernicious merge error that was preventing MSBuild from building Project2:

Project("{Guid1}") = "Project1", "Project1\Project1.csproj", "{Guid2}"
Project("{Guid1}") = "Project2", "Project2\Project2.csproj", "{Guid3}"
EndProject

While merging after my last git rebase, I accidentally chopped off an EndProject. Adding it back in fixed the issue, like so:

Project("{Guid1}") = "Project1", "Project1\Project1.csproj", "{Guid2}"
EndProject
Project("{Guid1}") = "Project2", "Project2\Project2.csproj", "{Guid3}"
EndProject

(I was using Visual Studio 2015)


If this is a new project added to a solution and all other projects are building fine, my guess is that the new project has not been included in the solution configuration build list. In VS Solution Explorer right click on the solution node and open the configuration manager dialog and make sure your new project is checked for build in all relevant configuration (Debug, Release...), I am talking about this dialog:

enter image description here