What is the best way to get build version number at runtime in web assembly client-side blazor app?
In server side version I was able to use Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion.ToString();
Combined with msbump package it was automatically generating new version for me with each new build. Is that possible to achieve at client side blazor too?
try using GetExecutingAssembly()
.
Example:
Assembly.GetExecutingAssembly().
GetCustomAttribute<AssemblyInformationalVersionAttribute>().
InformationalVersion;
The reason you can't use the entry assembly is I believe the entry assembly is not your actual assembly. So if you call out for executing assembly you are guaranteed to get your actual assembly.