Skip to content

How to evaluate a project while resolving its imports? #5819

@teo-tsirpanis

Description

@teo-tsirpanis

MSBuild has APIs to just evaluate a project's properties and items without building it (being aware of the disclaimers of #1285) but these do not take into accound any properties that are defined in any of the project's Imports.

I have thought of the following workaround: I will tell the BuildManager to build a nonexistent target, while passing BuildRequestDataFlags.SkipNonexistentTargets in the BuildRequestData.

My questions are:

  1. Is there anything problematic with the approach I described? MSBuild will fully evaluate the project file and "run" a target that does not exist, ignoring it as I told. The default target will be prevented from running.

  2. How about concurrency? It seems to me that the BuildManager class is not thread-safe. So instead of locking around its use, I have thought of creating and reusing BuildManager per thread. Is that good? Documentation says that "Normally there is only one build manager in a process, and it is the default build manager." but doesn't say what would happen if more than one build managers exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions