Skip to content

Conversation

@ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Jan 25, 2022

There are use-cases where you want to reference a Traversal SDK project, i.e. when you want to receive its P2P via the IncludeTransitiveProjectReferences feature. In such cases msbuild prints out an error when the tree is built with the --no-dependencies switch (or I guess when building inside VS) as that will trigger an MSBuild Exec task which calls into the GetTargetsPath target which currently either doesn't exist (?) for Traversal projects or returns a TargetPath instead of returning nothing. Hence adding this here to avoid the error that is being printed.

cc @jeffkl

There are use-cases where you want to reference a Traversal SDK project, i.e. when you want to receive its P2P via the `IncludeTransitiveProjectReferences` feature. In such cases msbuild prints out an error when the tree is built with the `--no-dependencies` switch (or I guess when building inside VS) as that will trigger an MSBuild Exec task which calls into the `GetTargetsPath` target which currently doesn't exist for Traversal projects. Hence adding this here to avoid the error that is being printed.
@ViktorHofer
Copy link
Member Author

Hmm unsure why tests are failing

@jeffkl
Copy link
Contributor

jeffkl commented Jan 31, 2022

Does this actually make things work or just get rid of the error about a missing target? I'm surprised this target doesn't need to return something...

@ViktorHofer
Copy link
Member Author

ViktorHofer commented Feb 4, 2022

It's not about a missing target but that the not built assembly of the Traversal project is returned when a project references the Traversal project. To answer your question, if the GetTargetPath target doesn't return anything, the non existent build output is not passed down to the caller. This already happens in the NoTargets project:

<!--
NoTargets projects do not build an assembly so dependent projects shouldn't get a path to the target. Override the GetTargetPath to do nothing.
-->
<Target Name="GetTargetPath" />
<!--
The GetTargetPathWithTargetPlatformMoniker target uses a BeforeTargets so the only way to disable it is to override it with an empty target.
-->
<Target Name="GetTargetPathWithTargetPlatformMoniker" />

Copy link
Contributor

@jeffkl jeffkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

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

Successfully merging this pull request may close these issues.

2 participants