1

How to get the version number programmatically from any .NET Core library DLL?
For e.g: "api-ms-win-core-console-l1-1-0.dll"

The same question is asked here but it is not working for core libraries listed below:

  • api-ms-win-core-console-l1-1-0.dll
  • api-ms-win-core-datetime-l1-1-0.dll
  • api-ms-win-core-debug-l1-1-0.dll

sample code

string file = @"C:\dotnet_core_lib\api-ms-win-core-console-l1-1-0.dll";
string  version = System.Reflection.AssemblyName.GetAssemblyName(file).Version.ToString();

I am getting following error message:
Error Message: "Could not load file or assembly 'api-ms-win-core-console-l1-1-0.dll' or one of its dependencies. The module was expected to contain an assembly manifest."

Community
  • 1
  • 1
RPrashant
  • 217
  • 3
  • 13
  • 2
    The files starting with api-ms-* are not dotnet assemblies. Here is a way to check if the dll is assembly or not. https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/assemblies-gac/how-to-determine-if-a-file-is-an-assembly – skimad Jul 09 '19 at 14:12

0 Answers0