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

你说的曾经没有我的故事 提交于 2021-02-18 22:11:20

问题


I build whole Visual Studio solution using msbuild, it worked fine but there is one project not being built when I build whole solution

This is my msbuild script

    <MSBuild Condition="'$(debug)' ==''"
             Projects="$(MySolution)"
             Targets="build"
             Properties="Configuration=Release">
      <Output TaskParameter="TargetOutputs"       ItemName="BuildOutput" />
    </MSBuild>

Something I need to check on this specific project in my Visual Studio solution?


回答1:


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




回答2:


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)



来源:https://stackoverflow.com/questions/8495534/visual-studio-project-not-being-built-when-i-build-solution-from-msbuild

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!