You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The premise is that I want to change the build output fully by only changing the Directory.Build.props/.targets in a common parent directory, and not have to do any changes to csproj for this since that is very cumbersome for a solution with hundreds or thousands of projects. One of the problems here then seems to be that e.g. TargetFramework is not defined at the point of Directory.Build.props. The same issue btw relates to Configuration and Platform and this has been a long standing issue since many then try to use these but they are often not defined at the point when Directory.Build.props is imported. Import order is somewhat covered in #2767 (comment) as far as I can tell.
Source code from blog post with the go to definition issue: CommonFlatBuild.zip
For a MSBuild novice like me I would think we are missing a set of extension points that complement the "outermost" Directory.Build.props/.targets so we perhaps instead could have something like:
Directory.Build.props
<LOTS OF IMPORTS ETC. props>
Directory.Project.props
<Project File>
Directory.Project.targets
<LOTS OF IMPORTS ETC. targets>
Directory.Build.targets
that is we would add "innermost" complements to Directory.Build.* in the form of say Directory.Project.*. This should cover more use cases.
However, perhaps there is another way of doing what I want that I just can't find.
I'm guessing a custom SDK would resolve this with minimal modification of the projects. I haven't created one of those before so I'm not sure the process.
I don't know how to that either or if that's a simple viable path. However, @Stefan75 appears to have found a possible solution as mentioned in nietras/nietras.github.io#21 using:
I'm a bit late but perhaps this is useful to someone.
CustomBeforeMicrosoftCommonProps, CustomBeforeMicrosoftCommonTargets, CustomAfterMicrosoftCommonProps and CustomAfterMicrosoftCommonTargets can be of good use as well.
In Common Flat Build Output I thought I'd finally found a clean solution to a long search for getting flat build output from msbuild for .NET. Unfortunately, this approach has a serious flaw as reported in F12 not working across C# projects in solution perhaps due to customized output paths in VS22. I then tweeted a bit about trying to fix the issue in https://twitter.com/nietras1/status/1462885254755147780 but I cannot find a good solution for it that does not require changing
csproj
files.The premise is that I want to change the build output fully by only changing the
Directory.Build.props/.targets
in a common parent directory, and not have to do any changes tocsproj
for this since that is very cumbersome for a solution with hundreds or thousands of projects. One of the problems here then seems to be that e.g.TargetFramework
is not defined at the point ofDirectory.Build.props
. The same issue btw relates toConfiguration
andPlatform
and this has been a long standing issue since many then try to use these but they are often not defined at the point whenDirectory.Build.props
is imported. Import order is somewhat covered in #2767 (comment) as far as I can tell.Source code from blog post with the go to definition issue:
CommonFlatBuild.zip
For a MSBuild novice like me I would think we are missing a set of extension points that complement the "outermost"
Directory.Build.props/.targets
so we perhaps instead could have something like:that is we would add "innermost" complements to
Directory.Build.*
in the form of sayDirectory.Project.*
. This should cover more use cases.However, perhaps there is another way of doing what I want that I just can't find.
cc: @KirillOsenkov @sharwell
The text was updated successfully, but these errors were encountered: