Visual Studio 2022, Version 17.3.6, does not Build dependant projects, if they are declared in an imported .targets file.

Fischer Dirk 14ES3 1 Reputation point

Use a target file to switch load of a solution project between project reference or assembly reference in all other project references of the solution.
This is detected correctly in Visula Studio 2022 Build Dependencies, Build Order and MsBuild and was detected correctly within Visual Studio 2013 totally.

But now the GUI and the DTE Model of Visual Studio 2022 fails. In that case, the dependant projects are not build correctly. The reason is, that visual studio 2022 does not check for last modification date of (all) imported target files to identify a correct decision for ReevaluateIfNecessary() (automatically).
In Visual Studio 2013 it was sufficient to modify a single target file imported in one of the projects causing the internal model and Solution Explorer gui to update totally.

Example: This is the initial state of references of a Project within the solution:


Now the project is unloaded from the solution.

The modification is actualized in build but does not affect the Solution Explorer, the internal model and the ReevaluateIfNeccessary() method of the original instance.

Another instance of Visual Studio 2022 loading the same project in that situation evaluates the target files correctly:

The target file modifying the configuration of the load context is:

An imported targets file, managing the reference changes for a single library from that example is:

All required target files are imported by the project files.

And this worked without any deep problems at all with Visual Studio 2013 easily.

The modification of the intermediate targets file is performed by a VSIX Plugin overloading OnAfterLoadProject of IVsSolution.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,863 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,594 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 51,071 Reputation points

    I think you should report this using the Report a Problem feature in Visual Studio. The MS team can look at it and either provide a workaround or identify a fix.

    1 person found this answer helpful.
    0 comments No comments