Saturday, December 7, 2019

It is possible to find indirect dependacies

Yesterday in 3 hours I wrote a program that find assembly usages in my code. It is nice to have knowledge about classes I need to refactor to replace library to another. How this program works:

  1. Read all assembly types to check they are used in my code.
  2. Iterate all project .cs files.
  3. For every source file use CSharpSyntaxWalker to traverse to all nodes in AST
  4. For every node ask SemanitcModel to GetDecalredSymbol.
  5. Filter all informative symbols like a IPropertySymbol, IlocalSymbol to read type from it and resolve it from assembly I need to replace.

Thank you for Roslyn it works as expected and it is easy to extend to find indirect dependencies in code to know all places for refactor.

No comments:

debug magazine archive

  71 jounals still available on issuu with great story of netlabels time.  debug_mag Publisher Publications - Issuu