💡 Tip: Use the walkthrough button below for a guided, step-by-step experience in VS Code.
Source: https://stackoverflow.com/a/76402801 (CC BY-SA 4.0) – Posted by alefragnani
▶ Open Interactive Walkthrough
Welcome! Follow these steps to build and run the .NET 10 Blazor WebAssembly chat application.
Before you start, ensure you have:
- .NET 10 SDK installed
- VS Code with C# extension (ms-dotnettools.csharp)
- Taskfile (optional, for using
taskcommands)
task restoreor
dotnet restoreThis downloads all NuGet dependencies for:
androidwasm– Blazor WebAssembly clientandroidwasm.ChatServer– ASP.NET Core API server
Status: ✅ Completed when you see Restore successful.
task buildor
dotnet build -c DebugCompiles both projects:
- Client output:
bin/Debug/net10.0/wwwroot - Server output:
bin/Debug/net10.0/androidwasm.ChatServer.dll
Status: ✅ Completed when the build succeeds without errors.
Open a new terminal and run:
task run:serveror
dotnet run --project androidwasm.ChatServer/androidwasm.ChatServer.csproj -c Debug --launch-profile httpsExpected output:
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7121
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
✅ Keep this terminal open. The server is now listening on https://localhost:7121.
Open a second terminal and run:
task run:clientor
dotnet run --project androidwasm.csproj -c Debug --launch-profile httpsExpected output:
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7218
✅ The client is now listening on https://localhost:7218.
Navigate to the chat room in your browser:
https://localhost:7218/chat
You should see:
- Room name input (default:
general) - Display name input (default:
guest) - "Join as agent" checkbox
- Join button
- Message history panel
- Enter a Display name (e.g.,
alice,agent-001) - Check the "Join as agent" checkbox
- Click Join room
- Type a test message and press Enter
You should see:
- System message:
[name] joined the room as agent(with agent badge) - Your message appears with timestamp and agent badge
Messages are persisted to SQLite:
androidwasm.ChatServer/chat-history.db
Open a new browser tab or incognito window and:
- Go to
https://localhost:7218/chat - Enter a different display name (e.g.,
bob) - Uncheck "Join as agent" to join as a regular user
- Send a message
Both users should see each other's messages in real time (polling every 2 seconds).
- File-scoped namespaces – Used throughout for cleaner code
- Record types – Message DTOs use immutable records
- Minimal APIs – Chat endpoints with top-level statements
- EF Core SQLite – Full ORM for persistence
- Global usings – Reduced boilerplate
See README.md and source code for examples.
# Format code
task format
# Run linting
task lint
# Clean build artifacts
task clean
# Run tests (when test projects are created)
task testIf you get "port already in use" errors:
# Kill processes on specific ports
# Linux/macOS: lsof -i :7121 | kill -9
# Windows: netstat -ano | findstr :7121The dev certificate may not be trusted. This is normal in development. Click "Proceed" in your browser.
Ensure both servers are running in separate terminals. Check that https://localhost:7121/api/rooms/general/messages is accessible.
- 📖 Read DEVELOPER.md for deployment and advanced setup
- 🧪 Read TESTS.md to add and run tests
- 🎯 See agents/plan/ for development milestone tracking
- 📚 Explore the README.md for links to Wasmtime, wasmCloud, and Taskfile docs
Ready? Start with Step 1 above! 🚀