Skip to content

How to only compile certain directories depending on target framework like in MAUI? #7782

Answered by rainersigwald
KieranDevvs asked this question in Q&A
Discussion options

You must be logged in to vote

MAUI does this via some fairly complicated, general logic in one of its .targets files: https://github.com/dotnet/maui/blob/c1439acf4dfeb0e5a6f56583d6a1860a12ff4a6f/.nuspec/Microsoft.Maui.Controls.SingleProject.targets#L72-L119

You can accomplish similar things with a more straightforward Compile Remove="myThing/**", though you should be aware of some behaviors in the project system that get confused with just Remove; I think that's why MAUI does the ExcludeFromCurrentConfiguration thing.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by KieranDevvs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants