Our latest


Announcements, Blogs, Releases and much much more...

  • Read our latest news and announcements, hot off the press.

Announcements






Category Blazor FAQ

Published on 12-May-2021

How do I check the framework version?
How do I check the framework version?
How do I check the framework version?

Using C# conditional preprocessor directives and predefined constants, you can check the Blazor target framework version.

Using C# conditional preprocessor directives and predefined constants, you can check the Blazor target framework version. For example, if the framework targets .NET 5.0, the code is compiled only in that specified condition. Follow these steps to check the Blazor target framework version.


[Index.razor]


@code {
    private string blazorVersion { get; set; }

    protected override void OnInitialized()
    {
#if NET5_0
        blazorVersion = "Blazor App version is .NET5.0";
#elif NETCOREAPP3_1
        blazorVersion = "Blazor App version is netcoreapp3.1";
#endif
    }
}


Created on 12-May-2021 Last updated 23-May-2021

Assigned Tag
  • Blazor
  • FAQ