Listing down .netassembly names
How many assembles do we have in .NET 3.5? Can I list them down For eg: System; System.Windows.Forms and so on...Please help with code in C#
Answers
You can download the .NET Framework 3.5 Common Namespaces and Types Poster on Microsoft's website.
Here's a quick program to search C:\Windows\assembly\ for all .dll assemblies and output the ones with a version of 3.5:
// Get all "*.dll" files from "C:\Windows\assembly". string windowsDirectory = Environment.GetEnvironmentVariable( "windir" ); string assemblyDirectory = Path.Combine( windowsDirectory, "assembly" ); string[] assemblyFiles = Directory.GetFiles( assemblyDirectory, "*.dll", SearchOption.AllDirectories ); // Get version of each file (ignoring policy, integration, and design files). var versionedFiles = from path in assemblyFiles let filename = Path.GetFileNameWithoutExtension( path ) where !filename.StartsWith( "policy" ) && !filename.EndsWith( ".ni" ) && !filename.EndsWith( ".Design" ) let versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo( path ) select new { Name = filename, Version = versionInfo.FileVersion }; // Select all 3.5 assemblies. var assembliesIn3_5 = versionedFiles .Where( file => file.Version.StartsWith( "3.5" ) ) .OrderBy( file => file.Name ); foreach( var file in assembliesIn3_5 ) Console.WriteLine( "{0,-50} {1}", file.Name, file.Version );
Based on this PowerShell query:
dir C:\Windows\assembly -filter *.dll -recurse | ? { [Diagnostics.FileVersionInfo]::GetVersionInfo($_.FullName).FileVersion.StartsWith('3.5.') } | % { [IO.Path]::GetFileNameWithoutExtension($_.Name) } | ? { -not $_.EndsWith('.ni') } | sort
Also, you might find Hanselman's Changes in the .NET BCL between 2.0 and 3.5 post useful.
I need to display the list to my students..they are interested in seeing if it can be done and if we can list only the assembles(class names) of .net 3.5