dotnet / dotnet/msbuild

`-getTargetResult` + `-target` behavior is unexpected

Open
#9,225 8 comments 0 reactions 1 assignee Claimed by @baronfel View on GitHub
bug Priority:1 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

`-getTargetResult` will run a target that otherwise would not run.

E.g. Given a project with targets `one` and `two` and the targets have no dependency between them:

```xml



One





Two



```

and given a command line with `-target:one -getTargetResult:two`, both targets will be executed.

The current behavior executes the targets provided to `-getTargetResult` that didn't already execute, after the 'standard' target build order. Essentially there is a secondary chain of targets.

It seems from the discussion that this is not the intended behavior.

My own quick take is that `-getTargetResult` should not itself cause a target to be executed and if a target provided to `-getTargetResult` didn't execute then there is no result to report.

_Originally posted by @jrdodds in https://github.com/dotnet/msbuild/issues/3911#issuecomment-1722378952_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.