I've got a .dll from a NuGet package that I use in a Blazor WebAssembly application. I want to be able to read the version of it.
Currently I read the version like so:
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(contentRootPath, @"bin\debug\net6.0\AssemblyName.dll"));
var version = $"{fileVersionInfo.FileDescription} ({fileVersionInfo.FileVersion})";
Instead of writing a path like this bin\debug\net6.0\AssemblyName.dll
how can I load the assembly and use Reflection to get the version?
Aucun commentaire:
Enregistrer un commentaire