Determine .NET Framework version for dll
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When you want to know which .NET Framework a DLL targets, you are really trying to identify the assembly's target framework metadata, not just the CLR version. Those are related, but they are not the same thing, and using the wrong signal can lead to incorrect compatibility assumptions.
Look for TargetFrameworkAttribute
The most direct clue is usually the assembly's TargetFrameworkAttribute. You can read it with reflection:
Typical output looks like .NETFramework,Version=v4.7.2. That is usually the answer people actually need.
CLR Metadata Is Not the Whole Story
Tools such as ILDASM or decompilers can also show the metadata runtime version, for example something like v4.0.30319. That is useful, but it does not uniquely identify the exact target framework version.
For example, many different .NET Framework versions use the CLR 4 runtime family. So:
- CLR version tells you the runtime generation,
- target framework tells you the intended framework contract.
If you need compatibility or deployment guidance, prefer the target framework value.
Use ILDASM or a Decompiler
If you do not want to write code, tools can show the same information. Open the DLL in ILDASM, ILSpy, dotPeek, or a similar decompiler and inspect the assembly metadata.
In many tools you will find either:
- the target framework attribute,
- the runtime metadata version,
- or both.
That makes GUI tools useful for one-off inspections when you are debugging a deployment issue or reviewing third-party binaries.
PowerShell Example
PowerShell can also inspect the target framework attribute:
This is handy in build scripts, deployment checks, or quick local diagnostics on Windows systems.
If you prefer a GUI path, ILSpy and similar tools often expose the same target framework information in the assembly metadata view, which is convenient when you are investigating a third-party DLL and do not want to write a helper script.
Be Careful With Modern .NET
Not every DLL targets classic .NET Framework. Some target .NET Core, .NET 5 and later, or .NET Standard. The same inspection technique still helps, but the output may look different, for example .NETStandard,Version=v2.0.
That is why the question should usually be framed as "what target framework does this assembly declare?" rather than "what .NET Framework version is this DLL?"
That wording is more precise and avoids false certainty in cases where the assembly can run in more than one compatible environment.
Common Pitfalls
- Using only the CLR metadata version and assuming it uniquely identifies the framework version.
- Confusing
.NET Frameworkwith.NET Standardor modern.NET. - Assuming every DLL will contain the same metadata pattern, especially older or unusual assemblies.
- Using file version or product version instead of target framework metadata.
- Treating the target framework as a guarantee that every runtime dependency is available on the destination machine.
Summary
- The best signal is usually the assembly's
TargetFrameworkAttribute. - CLR metadata version is informative, but it is not the same as the exact target framework.
- Reflection, PowerShell, ILDASM, and decompilers can all reveal the relevant metadata.
- Modern assemblies may target
.NET Standardor newer.NET, not classic .NET Framework. - Use target framework data for compatibility checks, not file version numbers.

