Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benvillalobos/96c2df11d4e503acb220e80c6d65e359 to your computer and use it in GitHub Desktop.
Save benvillalobos/96c2df11d4e503acb220e80c6d65e359 to your computer and use it in GitHub Desktop.
Hooking Into SetPlatform Negotiation

Say you want to modify each project reference once you know what platforms it can build as, the only place to do it (before PlatformNegotiation kicks in) is...

BeforeTargets=_GetProjectReferencePlatformProperties AfterTargets=_GetProjectReferenceTargetFrameworkProperties

_GetProjectReferenceTargetFrameworkProperties is the target that calls MSBuild on a project reference to gather its information (and see what it would build as). Only AFTER this target you can mess with ProjectReferences while understanding what they can build as.

If you target runs between the two above, you should have an _MSBuildProjectReferenceExistent item you can mess around with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment