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?
Ahead-of-time (AOT) compilation. Blazor WebAssembly supports ahead-of-time (AOT) compilation, where you can compile your . NET code directly into WebAssembly. AOT compilation results in runtime performance improvements at the expense of a larger app size.
Open Visual Studio 2019 and create a new project. Once Blazor App is selected, click Next button to configure the project name and location. Save the application, and then click Create button. Select Blazor WebAssembly App and click Create button to complete the application creation.
Yes, Blazor is ready to be used in production, it is a life changer, Blazor is a framework that optimizes development speed, helps considerably reducing code duplication and inconsistencies between front-end and api/backend models, and in turn it helps reducing bugs and development costs, in top of that, since Blazor ...
Blazor Server apps have direct access to server and network resources where the app is executing. Because Blazor WebAssembly apps execute on a client, they don't have direct access to server and network resources.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With