Skip to content

Instantly share code, notes, and snippets.

@ChrisMissal
Created July 30, 2013 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisMissal/6114030 to your computer and use it in GitHub Desktop.
Save ChrisMissal/6114030 to your computer and use it in GitHub Desktop.
Search a directory and subdirectories for DLLs by name and list by Version numbers descending.
var path = @"C:\dev\whatever"; var dllFileName = @"something.dll"; var files = from file in new DirectoryInfo(path).GetFiles(dllFileName, SearchOption.AllDirectories) let fvi = FileVersionInfo.GetVersionInfo(file.FullName) select new { File = file.FullName, Version = fvi }; files.OrderByDescending(f => f.Version.FileMajorPart) .ThenByDescending(f => f.Version.FileMinorPart) .ThenByDescending(f => f.Version.FileBuildPart) .Dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment