Assemblyinfo
Use mono cecil to read AssemblyInformation from a .NET assembly
Install / Use
/learn @peters/AssemblyinfoREADME
assemblyinfo
This small library uses cecil to inspect MSIL code found in .NET assemblies
instead of Assembly.Load which ensures that you do not have to load it's dependencies
beforehand. This is particularly useful if you just want to know what .NET target framework an
assembly is targeting without running the risk of catching an exception from Assembly.Load
because of a missing dependency.
Powershell
A powershell version is available here. Please note that there's a limitation where you cannot differentiate between NET45 and NET451. This is because the Microsoft PE and COFF Specification does not reveal this information.
Install via nuget
Install-Package assemblyinfo
Supported frameworks
- NET 4.5.1
- NET 4.5
- NET 4.0
- NET 3.5
- NET 2.0
Examples
Additional examples are available here
// Read from disk
AssemblyInfo.GetTargetFramework("myassembly.dll").IsEqualTo(TargetFramework.Net_2_0);
// Read from byte array
AssemblyInfo.GetTargetFramework(
File.ReadAllBytes("myassembly.dll")
).IsEqualTo(TargetFramework.Net_2_0);
// Read from stream
AssemblyInfo.GetTargetFramework(
new MemoryStream(File.ReadAllBytes("myassembly.dll"))
).IsEqualTo(TargetFramework.Net_2_0);
// Read from current assembly
AssemblyInfo.GetTargetFramework(
Assembly.GetExecutingAssembly()
).IsEqualTo(TargetFramework.Net_2_0);
// Determine minimum supported target framework
AssemblyInfo.GetTargetFramework(new List<string> {
"assembly1.dll",
"assembly2.dll"
}).IsGreaterThan(TargetFramework.Net_2_0);
// Determine minimum supported target framework
AssemblyInfo.GetTargetFramework(new List<string> {
"assembly1.dll",
"assembly2.dll"
}).IsLessThanOrEqualTo(TargetFramework.Net_4_5_1);
// Determine minimum supported target framework
AssemblyInfo.GetTargetFramework(new List<byte[]> {
File.ReadAllBytes("assembly1.dll"),
File.ReadAllBytes("assembly2.dll")
}).IsGreaterThanOrEqualTo(TargetFramework.Net_4_5_1);
License
MIT
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
