Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of msbuild switch /graphBuild appears to cause after.[solutionname].sln.targets not being loaded #10657

Open
vsfeedback opened this issue Sep 12, 2024 · 0 comments
Assignees

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


I recently notice that if I use the /graphBuild:true switch for msbuild.exe command line, it will ignore the targets specified in the after.[solutionname].sln.targets file.

For a quick repro, just use Visual Studio project creation template and to create a c++ console program project, and at the location where the solution .sln file is created, add a after.[solutionname].sln.targets file and in the file add the content

<Project>
 <Target Name="EmitCustomMessage" BeforeTargets="Build">
   <Message Importance="High" Text="---- Test Message ----" />
 </Target>
</Project>

When I do a build using msbuild.exe, I see that "Test Message" output:

D:\tmp\vs2022\TestSolution>"C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" "/p:Configuration=Release;Platform=x64" /t:build
MSBuild version 17.10.4+10fbfbf2e for .NET Framework
Build started 9/11/2024 10:25:11 AM.

Project "D:\tmp\vs2022\TestSolution\TestSolution.sln" on node 1 (build target(s)).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
EmitCustomMessage:
  ---- Test Message ----
Project "D:\tmp\vs2022\TestSolution\TestSolution.sln" (1) is building "D:\tmp\vs2022\TestSolution\TestProject\TestProject.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
...

But if I deleted the output folder and try again with /graphBuild:true, I don't see the "Test Message" being displayed as if that file doesn't exist.

D:\tmp\vs2022\TestSolution>"C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" "/p:Configuration=Release;Platform=x64" /t:build /graphBuild:true
MSBuild version 17.10.4+10fbfbf2e for .NET Framework
Build started 9/11/2024 10:25:38 AM.

Static graph loaded in 0.11 seconds: 1 nodes, 0 edges
Project "D:\tmp\vs2022\TestSolution\TestProject\TestProject.vcxproj" on node 1 (build target(s)).
PrepareForBuild:
...

Can someone fix this?


Original Comments

(no comments)


Original Solutions

(no solutions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants