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
2022-11-18T16:31:52.12+00:00

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:

261939-status1.png

Now the project is unloaded from the solution.
261920-image.png

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

Another instance of Visual Studio 2022 loading the same project in that situation evaluates the target files correctly:
261991-image.png

The target file modifying the configuration of the load context is:
261982-accessroomsportalprojectinformationsintermediatetm.txt

An imported targets file, managing the reference changes for a single library from that example is:
262001-rohdeschwarzdatamodeltargets.txt

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
    2022-11-18T16:35:24.993+00:00

    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