列出.netassembly名称

时间:2009-02-11 11:51:21

标签: c# .net-3.5

我们在.NET 3.5中有多少个组合?我可以列出它们,例如:系统; System.Windows.Forms等等......请帮助C#中的代码

3 个答案:

答案 0 :(得分:3)

您可以在微软的网站上下载.NET Framework 3.5 Common Namespaces and Types Poster

答案 1 :(得分:1)

以下是一个快速搜索C:\Windows\assembly\所有.dll程序集的程序,并输出版本为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 );

基于此PowerShell查询:

dir C:\Windows\assembly -filter *.dll -recurse | 
  ? { [Diagnostics.FileVersionInfo]::GetVersionInfo($_.FullName).FileVersion.StartsWith('3.5.') } | 
  % { [IO.Path]::GetFileNameWithoutExtension($_.Name) } | 
  ? { -not $_.EndsWith('.ni') } | 
  sort


此外,您可能会发现Hanselman的Changes in the .NET BCL between 2.0 and 3.5帖子很有用。

答案 2 :(得分:0)

我需要向我的学生显示列表..他们有兴趣看看是否可以完成以及我们是否只能列出.net 3.5的组件(类名)