Giter Club home page Giter Club logo

Comments (2)

rainersigwald avatar rainersigwald commented on June 16, 2024

What's happening here is that the Choose condition evaluation happens only in the properties evaluation pass (pass 1), at which time the condition isn't true--Directory.Build.props is imported before the body of the project, so IsTestProject hasn't been set yet when the condition evaluates.

ItemGroup evaluation happens later (in pass 3), after all properties (from all imports) have been set, so your step-6 condition evaluates to the value you expect.

I was a bit surprised by this Choose condition timing, and it doesn't seem to be well documented outside this comment which doesn't help anyone:

/// <remarks>
/// We enter here in both the property and item passes, since Chooses can contain both.
/// However, we only evaluate the When conditions on the first pass, so we only pulse
/// those states on that pass. On the other pass, it's as if they're not there.
/// </remarks>
private void EvaluateChooseElement(ProjectChooseElement chooseElement)

from msbuild.

myth384 avatar myth384 commented on June 16, 2024

Hi @rainersigwald,
If I understand correctly, the observed behaviour is by design. Which would be quite logical if project related files are interpreted in multiple passes and the Choose block is only evaluated once. The current behaviour is therefore quite obscure, and I would rather avoid its usage altogether.
Would it be an option to modify the behaviour of the Choose block so it is evaluated in each pass?

from msbuild.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.