- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- .NET_Framework/DLLのAssemblyVersionの取得 へ行く。
- 1 (2017-11-05 (日) 22:00:24)
DLLに埋め込まれたAssemblyVersionを確認するC#のプログラム。エクスプローラのプロパティからは通常確認することができない。
using System; using System.Reflection; using System.Collections.Generic; using System.Collections.ObjectModel; namespace DebugTool { class AssemblyAttributeDumper { static void Main(string[] args) { String DLL = args[0]; Assembly assembly = Assembly.LoadFrom(DLL); Console.WriteLine("AssemblyName\n {0}", assembly.FullName); Console.WriteLine("[Attrubutes]"); // 属性情報を取得する foreach (CustomAttributeData attrData in assembly.CustomAttributes) { Console.WriteLine(" {0}", attrData.AttributeType.Name); foreach (CustomAttributeTypedArgument cata in attrData.ConstructorArguments) { if (cata.Value.GetType() == typeof(ReadOnlyCollection<CustomAttributeTypedArgument>)) { Console.WriteLine(" Array of '{0}':", cata.ArgumentType); foreach (CustomAttributeTypedArgument cataElement in (ReadOnlyCollection<CustomAttributeTypedArgument>)cata.Value) { Console.WriteLine(" Type: '{0}' Value: '{1}'", cataElement.ArgumentType, cataElement.Value); } } else { Console.WriteLine(" Type: '{0}' Value: '{1}'", cata.ArgumentType, cata.Value); } } } } } }