Skip to content

Getting Started with Blazor3D

    Blazor3D is a simple way to add 3D features to your Blazor application. To use it you only have to add an only one row of code.

    Complete tutorials source code as well as other examples you can find in our GitHub repository.

    Using Blazor3D with Blazor WebAssembly project

    To create the Blazor WebAssembly project you can use the .NET CLI tool. Using the command prompt run the next command:

    dotnet new blazorwasm -o Blazor3DGettingStartedWASM

    Move to the Blazor3DGettingStartedWASM directory:

    cd Blazor3DGettingStartedWASM

    Add Blazor3D nuget package to the created project

    dotnet add package Blazor3D

    Open the current directory in Visual Studio Code

    code .

    Note

    You can use Visual Studio or any other IDE that supports .NET Core projects editing

    Inside a Visual Studio Code, open the Pages/Index.razor file and change the file content to the next

    @page "/"
    @using Blazor3D.Viewers;
    
    <Viewer UseDefaultScene=@true />
    

    Your IDE must look like the picture below:

    Using the command prompt run the next command:

    dotnet run

    Your command prompt must look like the picture below:

    Use your browser to open the link which is displayed first. In our case it’s https://localhost:7089

    The final result:

    Read next : Cleanup Blazor3D Projects

    Using Blazor3D with the Blazor Server project

    To create Blazor Server project you can use .NET CLI tool. Using the command prompt run the next command:

    dotnet new blazorserver -o Blazor3DGettingStartedSrv

    Move to the Blazor3DGettingStartedSrv directory:

    cd Blazor3DGettingStartedSrv

    Add Blazor3D nuget package to the created project

    dotnet add package Blazor3D

    Open the current directory in Visual Studio Code

    code .

    Note

    You can use Visual Studio or any other IDE that supports .NET Core projects editing

    Inside a Visual Studio Code, open the Pages/Index.razor file and change the file content to the next

    @page "/"
    @using Blazor3D.Viewers;
    
    <Viewer UseDefaultScene=@true />
    

    Your IDE must look like the picture below:

    Using the command prompt run the next command:

    dotnet run

    Your command prompt must look like the picture below:

    Use your browser to open the link which is displayed first. In our case it’s https://localhost:7272

    The final result:

    Read next : Cleanup Blazor3D Projects