Skip to content

setting OutputPath in a Directory.Build.targets #7669

Answered by Nirmal4G
NekkoDroid asked this question in Q&A
Discussion options

You must be logged in to vote

The OutputPath properties get overridden before hitting the Common targets and only at the end of Common targets, the Directory.Build.targets is imported. By purely looking at MSBuild evaluation, this should work but with all of the workarounds in the .NET SDK going on, it won't.

So, the only solution is to set this before the .NET SDK targets are imported (implicitly), which is just before </Project> tag on your project file.

There are two ways you can go about this...,

Using BeforeTargetFrameworkInferenceTargets property

Separate the above "Project Output" and "Plugins Output" sections to a new targets file, let's say JustBeforeSdk.targets and then put the following in your Directory.Bu…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@NekkoDroid
Comment options

Comment options

You must be logged in to vote
1 reply
@NekkoDroid
Comment options

Answer selected by NekkoDroid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants