Let’s say I want to write a program that takes a C# source code file ( just one single .CS file, not anything complicated) and I want this program to analyze that source code and as the result tell me what .NET DLLs do I need for the methods that are used in that source file. Is this even technically possible?
so for example if in that source file there is only a Console.Writeline() method I want it to be able to tell me that “mscorlib.DLL” is needed.
In order to do this you will essentially need to write a compiler. The only way to determine what DLL’s are needed is to first determine what ever identifier / name in the source file binds to. Once you’ve established what names bind to then you can understand what DLLs are necessary (assuming there is a DLL list to choose from).
Understanding name binding though requires your program understand …
In short, you need a compiler 🙂