dotnet / dotnet/msbuild

Indicating a dependency on the outer build of a multi-targeted project

Open
#11,467 1 comment 1 reaction 1 assignee Claimed by @rainersigwald View on GitHub
Area: Documentation triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

Let's say you have a multi-targeted project A and a project B that references A.

Project A generates a package on build.

Project B doesn't wait until project A builds the Pack target, because ResolveProjectReferences calls the Build target in project A with a specific nearest target framework. So when project A builds, the Pack target is not invoked (`IsInnerBuild == true`):

```
Target "_PackAsBuildAfterTarget" skipped, due to false condition; ('$(GeneratePackageOnBuild)' == 'true' AND '$(IsInnerBuild)' != 'true') was evaluated as ('true' == 'true' AND 'true' != 'true').
```

Is there a way to indicate a dependency on the outer build of project A, so that project B waits until project A builds the package? Project B then wants to copy the resulting .nupkg elsewhere but we get a race condition because project B attempts to copy it while the Pack target of project A is still running.

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.