Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the import order of the common msbuild extension points. #2767

Open
cdmihai opened this issue Dec 1, 2017 · 4 comments
Open

Document the import order of the common msbuild extension points. #2767

cdmihai opened this issue Dec 1, 2017 · 4 comments
Labels
Documentation Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com) triaged

Comments

@cdmihai
Copy link
Contributor

cdmihai commented Dec 1, 2017

It is not clear to users how the import order looks like, considering that there are implicit top and bottom imports for:

  • directory.build.props and directory.build.targets
  • nuget package based build logic
  • msbuild SDK top and bottom imports

Users need to know how to compose all three of these entities to achieve the import ordering that they want.

@cdmihai cdmihai added the Documentation Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com) label Dec 1, 2017
@Nirmal4G
Copy link
Contributor

Nirmal4G commented Jul 23, 2019

Current (upto v17) Import Order, with and without the SDK-style

Microsoft.Common.props

  • Directory.Build.props
  • <ProjectFileNameWithExt>.<Vendor>.<Tag>.props
  • MSBuildUserExtensions Wildcard-ImportBefore
  • MSBuildExtensions Wildcard-ImportBefore
  • CustomBeforeMicrosoftCommonProps
  • <CommonProps>
  • CustomAfterMicrosoftCommonProps
  • MSBuildUserExtensions Wildcard-ImportAfter
  • MSBuildExtensions Wildcard-ImportAfter

.NET SDK props

  • AlternateCommonProps (Added in v3) OR Microsoft.Common.props
  • <SDK props>

Project File

  • <Project File>

.NET SDK targets

  • <SDK Before targets> (also includes BeforeTargetFrameworkInferenceTargets; Added in v5)
  • <LanguageTargets> Microsoft.Common.targets
  • <SDK After targets>
  • NuGet.Build.Tasks.Pack.targets

Microsoft.<Lang>.targets

  • <Lang Before imports>
  • <Lang Compiler targets>
  • <Lang DesignTime targets>
  • Microsoft.Common.targets
  • <Lang After imports>

Microsoft.Common.targets

  • Microsoft.Common.props (if not imported before)
  • <ProjectFileNameWithExt>.user
  • MSBuildUserExtensions Wildcard-ImportBefore
  • MSBuildExtensions Wildcard-ImportBefore
  • CustomBeforeMicrosoftCommonTargets
  • <CommonTargets>
  • CustomAfterMicrosoftCommonTargets
  • MSBuildUserExtensions Wildcard-ImportAfter
  • MSBuildExtensions Wildcard-ImportAfter (NuGet Restore targets, imported here)
  • <ProjectFileNameWithExt>.<Vendor>.<Tag>.targets
  • Directory.Build.targets

Note: The Xaml, CSharp, VisualBasic, FSharp targets wrap around Common targets and have similar extension points. I didn't include the imports of the inbox targets for simplicity. You can use MSBuild Log Viewer to inspect your own projects' imports.

@Nirmal4G
Copy link
Contributor

So, How will we put the above monstrosity into docs and make people understand them easily?

@cdmihai
Copy link
Contributor Author

cdmihai commented Jul 29, 2019

Thanks for looking it up. Can you create a PR and add them to https://github.com/microsoft/msbuild/tree/master/documentation?
The binlog viewer should also aid users in understanding the import order.

@Nirmal4G
Copy link
Contributor

OK. Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com) triaged
Projects
None yet
Development

No branches or pull requests

3 participants