Skip to content

Configuration property shouldn't be read in Directory.Build.props #995

Closed

Description

@Youssef1313

It's too early to read Configuration in Directory.Build.props without a workaround to set it manually to Debug when not set.

I think it's best to avoid reading the properly that early altogether. See also dotnet/msbuild#12792

Activity

  1. eiriktsarpalis commented on Nov 20, 2025

    @eiriktsarpalis
    Member

    What's the recommended workaround? Move to Directory.Build.targets or something different?

  2. Youssef1313 commented on Nov 20, 2025

    @Youssef1313
    ContributorAuthor

    I tried to move to Directory.Build.targets but didn't work, I didn't investigate why though.

  3. added
    help wantedContributions welcome from those familiar with codebase
    ready for workHas enough information to start
    P3Nice to haves, rare edge cases
    on Jul 20, 2026
  4. added this to the 2.x milestone on Jul 27, 2026
  5. lntutor commented on Jul 30, 2026

    @lntutor
    Contributor

    I am working on this. The key is to split the path setup by evaluation phase: keep configuration-independent BaseOutputPath/BaseIntermediateOutputPath values in the root Directory.Build.props, let MSBuild append the now-initialized configuration to OutputPath/IntermediateOutputPath, and define the package/test-result paths in a root Directory.Build.targets. The existing src/Directory.Build.targets must import the root targets (as src/Directory.Build.props already does for the root props), otherwise it shadows them. I will verify both Debug/Release property evaluation plus solution build, pack, and test behavior.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Nice to haves, rare edge casesbugSomething isn't workinghelp wantedContributions welcome from those familiar with codebaseready for workHas enough information to start

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions