Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Followers 0
Login Register as User

Blazor App mit Webseite und IoT Sensor Code erstellen

03.02.2022 (👁14498)

Mit folgendem Code kann einfach eine komplette Blazor Anwendung auf einem Raspberry Pi erstellt werden.

pi@raspberrypi:~ $ dir

bin  Bookshelf  Desktop  Documents  Downloads  Music  obj  pi.csproj  Pictures  Program.cs  projects  Public  ScreenShots  sqlite_app  Templates  thinclient_drives  Videos  vsdbg

pi@raspberrypi:~ $ cd projects

pi@raspberrypi:~/projects $ mkdir Blazor.Pi

pi@raspberrypi:~/projects $ cd Blazor.Pi

pi@raspberrypi:~/projects/Blazor.Pi $ dotnet new -i Microsoft.AspNetCore.Blazor.Templates


The following template packages will be installed:



Warning: Microsoft.AspNetCore.Blazor.Templates is not found in NuGet feeds

Microsoft.AspNetCore.Blazor.Templates could not be installed, the package does not exist.


pi@raspberrypi:~/projects/Blazor.Pi $ dotnet new blazorwasm --hosted

The template "Blazor WebAssembly App" was created successfully.

This template contains technologies from parties other than Microsoft, see for details.


Processing post-creation actions...

Running 'dotnet restore' on /home/pi/projects/Blazor.Pi/Blazor.Pi.sln...

  Determining projects to restore...

  Restored /home/pi/projects/Blazor.Pi/Shared/Blazor.Pi.Shared.csproj (in 676 ms).

  Restored /home/pi/projects/Blazor.Pi/Server/Blazor.Pi.Server.csproj (in 14.4 sec).

  Restored /home/pi/projects/Blazor.Pi/Client/Blazor.Pi.Client.csproj (in 25.28 sec).

Restore succeeded.


pi@raspberrypi:~/projects/Blazor.Pi $ dir

Blazor.Pi.sln  Client  Server  Shared


pi@raspberrypi:~/projects/Blazor.Pi $ cd Server

pi@raspberrypi:~/projects/Blazor.Pi/Server $ dotnet add package System.Device.Gpio


  Determining projects to restore...

  Writing /tmp/tmp72MFEo.tmp

info : Adding PackageReference for package 'System.Device.Gpio' into project '/home/pi/projects/Blazor.Pi/Server/Blazor.Pi.Server.csproj'.

info :   GET

info :   OK 1176ms

info : Restoring packages for /home/pi/projects/Blazor.Pi/Server/Blazor.Pi.Server.csproj...

info :   GET

info :   OK 555ms

info :   GET

info :   OK 39ms

info : Installed System.Device.Gpio 2.0.0 from with content hash 7PsI5uD18QZP/60vPxQyhYlm2HywVythMxWeOkL7QAO8ZrSeJO1+ijn18Yd2q87dL9ED1MVCTKyR+DVPjxwx2w==.

info : Package 'System.Device.Gpio' is compatible with all the specified frameworks in project '/home/pi/projects/Blazor.Pi/Server/Blazor.Pi.Server.csproj'.

info : PackageReference for package 'System.Device.Gpio' version '2.0.0' added to file '/home/pi/projects/Blazor.Pi/Server/Blazor.Pi.Server.csproj'.

info : Committing restore...

info : Generating MSBuild file /home/pi/projects/Blazor.Pi/Server/obj/Blazor.Pi.Server.csproj.nuget.g.targets.

info : Writing assets file to disk. Path: /home/pi/projects/Blazor.Pi/Server/obj/project.assets.json

log  : Restored /home/pi/projects/Blazor.Pi/Server/Blazor.Pi.Server.csproj (in 1.59 sec).


pi@raspberrypi:~/projects/Blazor.Pi/Server $ dotnet run


info: Microsoft.Hosting.Lifetime[14]

      Now listening on: https://localhost:7253

info: Microsoft.Hosting.Lifetime[14]

      Now listening on: http://localhost:5061

info: Microsoft.Hosting.Lifetime[0]

      Application started. Press Ctrl+C to shut down.

info: Microsoft.Hosting.Lifetime[0]

      Hosting environment: Development

info: Microsoft.Hosting.Lifetime[0]

      Content root path: /home/pi/projects/Blazor.Pi/Server/




Man findet das Code Beispiel unter: