✅ Insert a Directory.Build target into project dependency pipeline
The question was a bit too long to fit into this format, so I posted it here: https://stackoverflow.com/questions/76132805/insert-a-directory-build-target-into-project-dependency-pipeline
TL;DR; - I have a target in
Directory.Build.targets
that I want to execute during the build of every project built by my solution, especially when it's building projects that are pulled in by project reference as dependencies, but it only runs for some projects.Stack Overflow
Insert a Directory.Build target into project dependency pipeline
I have projects spread across two solutions, call them Mine.sln and Theirs.sln (and they live in separate repositories). The projects in Theirs are all dependencies for Mine. The two solutions are
15 Replies
I think, in theory, you should be able to have your
Directory.Build.targets
file override all the <HintPath>
values to null
, with just MSBuild syntax
like, I use Directory.Build.targets
to partially-override PackageReference
options, as follows
so, something like
might work?
really, this whole setup sounds kinda nutsunfortunately I don't even have
PackageReference
to work with; this is pre-SDK
yesyou're pulling projects NOT in your own source control into your solution
it is my own source control, just separate repositories (because separate teams)
right
spanning a solution across multiple repositories just reeeeeally seems like a poor setup
this setup is 100% nuts, but I was hoping to do this more-or-less in isolation; if I try to tackle the real problem, then it's a whole cross-team thing with lots of process and friction
understandable
which is why I'm not gonna just say "you're dumb, change your setup"
professionals do all kindsa dumb shit in the real world, to get by
innit, tho?
but yeah, I dunno of a good solution here
I kinda forget what the precursor to
PackageReference
is
but it OUGHT to behave the same sorta way as PackageReference
as far as MSBuild syntax goesthere wasn't really a precursor. it's
AssemblyReference
with HintPath
, and it's managed by the IDE.well, that's what I was referring to
the super weird thing here is that even if I just attach my target to a target (like
Build
) that has to run for literally every project and project dependency, recursively, I don't get the Message
output I would expect.Stack Overflow
How does ResolveProjectReferences work?
I want to profile and tweak our build hoping to save few seconds here and there. I was able to create a task that derives from ResolveAssemblyReferences and use it instead, but I'm having problems in
and I wonder if that
MSBuild
task that actually builds the dependencies doesn't pick up the Directory.Build.targets
file from the originating solution
although that doesn't completely answer it for me, because I do get messages for a couple of the dependency projects and I haven't yet figured out why
aha. I think I figured that part out: there's another Directory.Build.targets in the Theirs.sln
solution directory <:picard_facepalm:616692703685509130>Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.