The current article recommends including the following Import to include subsequent Directory.Build.props files in your project's directory tree.
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
This can be made more generic to work for both Directory.Build.props and Directory.Build.targets
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..))" />
Further, this can be made to work regardless of whether subsequent Directory.Build.* files exist (only recommended if you control and trust parent directories).
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..))" Condition="Exists($([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..)))" />
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
actually I was having some strange errors with "value of the project attribute in element import is invalid " this solution solved my problem.
@grantborthwick Thank you for the feedback! Though while this solution is more flexible, it moves away from the main topic of concern which is Directory.Build.props.
Thank you for this suggestion and will definitely keep it under consideration for future restructuring of the article.
Most helpful comment
actually I was having some strange errors with "value of the project attribute in element import is invalid " this solution solved my problem.