jeudi 21 novembre 2019

Find class references in c# source code with roslyn

I want to find all class references within code. I have looked at Roslyn and its features, but i am kind of in over my head with all of its features. All examples i have seen start off with small code snippets that are being read in, but i would like to just point my code to an assembly let its magic work.

So, given a class structure like this:

class MyClassA { }
class MyClassB 
{
   void Do()
   {
      var instance = new MyClassA();      
   }
}

All i really want is to find all those dependencies (eg. the "references" feature of Visual Studio, just in code) between MyClassA and MyClassB. I could either point it to already compiled assemblies, but also point to a proj or sln file.





Aucun commentaire:

Enregistrer un commentaire