diff --git a/ICSharpCode.Decompiler/TypeSystem/IAssembly.cs b/ICSharpCode.Decompiler/TypeSystem/IAssembly.cs
index da8148f90..b14a5566d 100644
--- a/ICSharpCode.Decompiler/TypeSystem/IAssembly.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/IAssembly.cs
@@ -18,6 +18,7 @@
#nullable enable
+using System;
using System.Collections.Generic;
using ICSharpCode.Decompiler.Metadata;
@@ -65,6 +66,11 @@ namespace ICSharpCode.Decompiler.TypeSystem
///
string AssemblyName { get; }
+ ///
+ /// Gets the assembly version.
+ ///
+ Version AssemblyVersion { get; }
+
///
/// Gets the full assembly name (including public key token etc.)
///
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs
index 6db846f4d..04991c76c 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs
@@ -45,6 +45,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
public ICompilation Compilation { get; }
CorlibTypeDefinition[] typeDefinitions;
readonly CorlibNamespace rootNamespace;
+ readonly Version asmVersion = new Version(0, 0, 0, 0);
private MinimalCorlib(ICompilation compilation, IEnumerable types)
{
@@ -56,6 +57,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
bool IModule.IsMainModule => Compilation.MainModule == this;
string IModule.AssemblyName => "corlib";
+ Version IModule.AssemblyVersion => asmVersion;
string IModule.FullAssemblyName => "corlib";
string ISymbol.Name => "corlib";
SymbolKind ISymbol.SymbolKind => SymbolKind.Module;
diff --git a/ICSharpCode.Decompiler/TypeSystem/MetadataModule.cs b/ICSharpCode.Decompiler/TypeSystem/MetadataModule.cs
index f4f4b7396..622c510a2 100644
--- a/ICSharpCode.Decompiler/TypeSystem/MetadataModule.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/MetadataModule.cs
@@ -66,6 +66,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
try
{
this.AssemblyName = metadata.GetString(asmdef.Name);
+ this.AssemblyVersion = asmdef.Version;
this.FullAssemblyName = metadata.GetFullAssemblyName();
}
catch (BadImageFormatException)
@@ -117,6 +118,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
public bool IsMainModule => this == Compilation.MainModule;
public string AssemblyName { get; }
+ public Version AssemblyVersion { get; }
public string FullAssemblyName { get; }
string ISymbol.Name => AssemblyName;
SymbolKind ISymbol.SymbolKind => SymbolKind.Module;