MSBuild TargetOutputs missing assemblies

[亡魂溺海] 提交于 2019-12-12 03:43:05

问题


I am building a solution file with code similar to the following;

<Target Name="Build">
  <MSBuild Projects="$(MySolution)"
           Targets="Build"
           BuildInParallel="false"
           Properties="Configuration=$(Configuration);Platform=$(Platform);">     
    <Output ItemName="MyOutputs" TaskParameter="TargetOutputs"/>
  </MSBuild>

  <Message Importance="High" Text="MyOutputs=@(MyOutputs)" />
</Target>

And the output from that message that is supposed to show a list of assemblies that were built is missing some projects - projects that are actually being built (as they are shown being built in the rest of the log).

I found a descernible difference in the solution file regarding these projects: They each have a "ProjectSection" where others do not.

For example, this project is being sent to @(MyOutputs)

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Foo", "Foo\Foo.csproj", "{075C4960-951B-43FA-AAC5-99497C9C0EBC}"
EndProject

Whereas this one is not:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bar", "Bar\Bar.csproj", "{EA7EEBE4-F7DB-4148-8B00-F49D747FA7B1}"
    ProjectSection(ProjectDependencies) = postProject
        {8B31D756-F858-43CA-81A7-5B4797554263} = {8B31D756-F858-43CA-81A7-5B4797554263}
    EndProjectSection
EndProject

Would someone care to enlighten me on why this is happening, or what the consequences of removing these ProjectSections are?


回答1:


I have just encountered this same issue. It isn't feasible for our application to be built with explicit project references, and not having the project listed in the TargetOutputs variable is blowing up some post-build analysis being performed. We were unable to find a solution so I posted the question to the MS Connect site here with some example code to reproduce the issue:

https://connect.microsoft.com/VisualStudio/feedback/details/1176406/msbuild-targetoutputs-does-not-include-projects-with-explicit-project-dependencies-listed




回答2:


I found my issue was this

I was doing this:

msbuild.exe myproject.vbproj /T:Rebuild
msbuild.exe myproject.vbproj /T:Package

VS This:

msbuild.exe myproject.vbproj /T:Rebuild;Package

I have no idea why this work or why it didn't in the first place. But hope that helps.



来源:https://stackoverflow.com/questions/11236289/msbuild-targetoutputs-missing-assemblies

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