How to make a transitive task? #11382
Unanswered
timcassell
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I created a task to run an assembly weave with
Mono.Cecil
in an after build target. I want this task to run on all projects that reference my project via<ProjectReference>
.From working with CoPilot, it explained that
ProjectReference
s cannot have transitive tasks, onlyPackageReference
s can via .targets file. So I thought, ok, I can just use aBeforeTargets="Restore"
task exec command powershell script to clear the nuget cache and build the package, and add aPackageReference
to the newly built package with a local<RestoreSources>
, and that will be transitive. This seems to work fine when I build my project (usingdotnet build
), however, when I build another project that has aProjectReference
to my project, the target doesn't run, so my script doesn't execute, and the build fails if the package didn't exist already (or doesn't have up-to-date code if it did exist).When I ask CoPilot how to solve it, it just goes around in circles. Am I missing something, or is it just not possible? It feels so close...
Beta Was this translation helpful? Give feedback.
All reactions