Description
For the extension to work, you need to specify a configuration file that essentially only contains paths (one per line) for searching for projects:
When you click the
Use ProjectReference button, the extension looks through the list of projects included in the solution and begins to process each of them sequentially.
Project dependency search is based on
project.assets.json file, which lists all the dependencies of the project. It is created in the /obj folder when using dotnet restore or dotnet build as it implicitly calls restore before build, or msbuid.exe /t:restore with MSBuild CLI. If project.assets.json is not found in the specified project directory, then the extension stops processing and displays the following message:
If the file is present, then the extension starts processing explicit and implicit (transitive) dependencies of the project - NuGet packages, framework assemblies. After processing, the Messages tab of the Error List displays information about each changed project and the references included in it.
Conditional references
When working with references, only evaluated items are used. In this example, when using the Debug configuration, reference A will be replaced, while for the Release configuration, reference B.
Multitargeting
Multitargeting as such does not have special support, i.e. a project with
TFMs defined as follows:
Will be processed as if it had
TFMs :
Comments
Separate lines entered in the configuration file can be commented out as follows:
With this configuration, at the moment of switching references, the search for in the commented out directories will be ignored.
Requirements
It is assumed that in the stable version the extension should support Visual Studio 22. The author conducted an initial test in the next version of Visual Studio:
.NET Core SDK version >= 3.0 is required since version 0.5.0.
Useful Links |