visual studio · assemblies · csharp

Reading assemblies from a given Visual Studio solution file

Today, I needed a piece of code that will get a .sln (Visual Studio Solution) file, and find all the projects (.csproj) that are defined in the solution file, and return all the assembly names (uniquely) from those projects. However, I cannot find a single sample that does that, so I decided to write my own. I hope it helps someone out there.

Using the code is extremely simple:

var lister = new AssemblyNameLister(@"C:\Project\Test\TestSolution.sln", @"C:\Users\Public\assembly-names.txt");