How to get all implicitly referenced dlls by netcore project?

Viewed 380

Context

I am currently developing some sort of ide with extensive code generation, which uses C# as the target language for translation from another high-level language.

Problem

Now I am trying to implement an auto-completion feature, like in VisualStudio or rider. But, I stuck with a question - where from could I retrieve available symbols (like classes, struct, namespaces, etc.) which are defined in netcore framework DLL's like mscorlib.dll, System.Data.dll?

I am particularly interested in netcore based projects, which are defined by XML .csproj files.

I am pretty sure that there should be some library/NuGet-package which are made for resolving csproj dependencies and stuff. But it's pretty hard to find because Google results are cluttered with tons of "beginner-friendly" Microsoft manuals, which tell you how to create a new project with dotnet new.

Input Data: Let's say we have .csproj like this:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net5.0</TargetFramework>
    </PropertyGroup>
</Project>

There we have two important strings Sdk="Microsoft.NET.Sdk", which as I understand determines a set of MSBuild-related stuff, like targets, and other stuff. And net5.0 which somehow transforms into a reference to some mysterious NuGet meta-package.

There could be some other variation of those two, and these variations lead to different implicitly referenced packages, and I want to know which one exactly.

Desired output data

It would be great to have some kind of csproj abstraction, which could provide a list of all dependencies, explicit and implicit, which could be later parsed by Mono.Cecil, and so on.

I know, that there are Roslyn, Nuget, and MsBuild. But which one of them should I use, and how?

0 Answers
Related