I want to disable ReferenceTrimmer based on other properties defined in the csproj. This has to be done in Directory.Build.targets because otherwise i cannot access properties from the csproj.
If i set EnableReferenceTrimmer in the Directory.Build.targets it does not actually affect ReferenceTrimmer though.
This is because ReferenceTrimmer.targets is loaded before Directory.Build.targets and adds CollectDeclaredReferences to CoreCompileDependsOn already.
Possible solution in my eyes: Add a condition based on EnableReferenceTrimmer to CollectDeclaredReferences