Live Chat Icon For mobile
Live Chat Icon

How do I check the framework version?

Platform: Blazor| Category: General

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.


@page "/"


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

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

Refer to this link for more details.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.