This project is a sample Blazor Chat Application demonstrating the use of Blazor WebAssembly and ASP.NET Core Web API. The application includes features such as real-time messaging, user authentication, and a responsive UI.
- .NET
- Visual Studio
- SQL Server Instance
- CosmoDB
- Docker Desktop
- Visual Studio Code
- SQL Server Management Studio
- Clone the repository to your local machine.
- Locate the file docker_setup.ps1 in the root of the project and run this in PowerShell which will setup the Docker Containers and Dependencies.
- To get started with this project, you will need to clone the repository and then open the solution in Visual Studio.
- Once the solution is open, you will want to build the solution. This will download all of the NuGet packages that are required or the project.
- Open the Database.Example project and build the project then publish using the "StartupExample.publish.xml" profile.
- There should be no need to update the secrets.json file with the connection string as it should be configured in the appsettings.json file for SQL Server Instance.
- Open the project in Visual Studio
- Build the database project and publish to your local SQL Server instance.
- Update-Database -Project Blazor.Chat.App.Data -StartupProject Blazor.Chat.App.Web
We are using Docker Services in this project as a "Developer Toolbox" to provide a cafeteria style approach to meeting development dependency needs primarily for local development.
This project includes example docker-compose*.yml files in the containers/ directory. These are provided primarily as reference implementations to help teams get started with local development and integration scenarios. The included containers cover common services, but your team should review and reduce the number of containers to match your specific requirements and workflow. Customizing the setup will help streamline development and resource usage.
Devcontainer support is also available, enabling you to use Visual Studio Code's remote container features for a consistent development environment. This makes onboarding easier and ensures dependencies are managed in a reproducible way. See the devcontainer configuration for details on how to launch the project in a containerized VS Code environment.
- Start Visual Studio and open the solution.
- Open the Database.Example project and build the project then publish using the "StartupExample.Docker.publish.xml" profile. Using the default password of "P@ssword123!".
- MailHog was added as an email trap.
- Open Telemetry was added to the project to help with debugging and development and can be found here after starting the docker containers.
- Watch the following video for why and how its used: The Logging Everyone Should Be Using in .NET
- Once the project has been built and the database has been created, you can run any of the applications.
If you are using CodeSpaces you'll want to update your container git configuration profile. Be sure to update with your appropriate name and email details.
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
This document outlines the resources generally needed to do development on this project. Some resources are not critical but recommended.
β Required Resource β
This includes .NET 8 and .NET 9.
winget install Microsoft.DotNet.SDK.8
winget install Microsoft.DotNet.SDK.9
π Recommended π
This utility provides windows a Unix like tabbed console window manager.
winget install Microsoft.WindowsTerminal
β Required Resource β
DevOps customized commands are written using the latest version of PowerShell.
winget install Microsoft.PowerShell
π Recommended π
These tools provide CLI support for interacting with and managing Azure resources from your console. Some of these tools may be required depending on some of the development work required such as FunctionsCoreTools if doing function app development.
winget install Microsoft.AzureCLI
winget install Microsoft.Azd
winget install Microsoft.Azure.FunctionsCoreTools
If you need to work with Azure Blob Storage this Visual GUI tool provides easy access and management of content stored in an Storage resource in Azure.
winget install Microsoft.Azure.StorageEmulator
winget install Microsoft.Azure.StorageExplorer
β Required Resource β
This adds the windows GIT client to interact with git based repositories.
winget install Git.Git
π Recommended π
These are two recommended GUI wrapper clients for the git Cli. These are not required but maybe helpful in managing repository changes and visualizing history and branching better. Atlassian's tool works very well at providing a history tree view for tracking changes. Both Visual Studio and VS Code have git support making these tools optional, additionally the integration with GitHub Copilot is very helpful when making code commits through Visual Studio or VS Code.
winget install Atlassian.Sourcetree
winget install GitHub.GitHubDesktop
π Recommended π
β License Required β
When performing merging of branches, the BeyondCompare tool has been fantastic. This tool also supports comparisons between folders making it easier to perform diffs between two large directory structures. This tool also integrates well with Atlassian Source Tree.
winget install ScooterSoftware.BeyondCompare.5
π Recommended π
winget install Postman.Postman
π Recommended π
winget install Bruno.Bruno
π Recommended π
Having a local instance of SQL Server can be helpful for development purposes. However, if you are using Docker there is a built in container image for SQL Server that can be used instead. This is recommended as it provides a more consistent environment across developers and does not require installation of a local database engine. However, if needed, it can be installed locally.
winget install Microsoft.SQLServer.2022.Express
β
Required Resource β
β License Required β
Our primary development uses Visual Studio and / or Visual Studio Code There are three options for Visual Studio, Enterprise, Professional, and Community. The Community edition is free and sufficient for most development needs. The Professional and Enterprise editions require a license. Check with your Engineering Manager to see if you need a license for the Professional or Enterprise editions.
winget install Microsoft.VisualStudio.2022.Enterprise
winget install Microsoft.VisualStudio.2022.Professional
winget install Microsoft.VisualStudio.2022.Community
winget install Microsoft.VisualStudioCode
π Recommended π
Having the ability to query the database is required, however, SQL Server Management Studio is recommended as the primary tool for doing so.
winget install Microsoft.SQLServerManagementStudio
π Recommended π
This resource provides local development tools and resources will speed up developer setup and configuration and provide diagnostic and debugging resources not previously available. The number of options and tools is near limitless. This project uses Docker Desktop to provide a local development environment for .NET and React development. It includes support for DevContainers, RedisCache, OpenTelemetry durability, MailHog mail trap, Azurite, and more.
winget install Docker.DockerDesktop
π Recommended π
It is recommended to periodically run the dotnet workload update command, as this will help keep your local development tools and resources up to date. Running Visual Studio updates do not always update all of the dotnet resources.
If you desire experimenting with Aspire resources it is recommended to install the wasm-tools and aspire workloads. Lastly, the LibraryManager provides resources for using libman.json configuration files to automatically download web resources such as jQuery, Bootstrap, and other libraries for web development.
dotnet workload update
dotnet workload install wasm-tools
dotnet workload install aspire
dotnet tool install -g Microsoft.Web.LibraryManager.Cli
This will update PowerShell permissions settings to grant unsigned scripts access to run locally.
Run as local machine administrator
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
π Recommended π
A DevContainer is a development environment defined by a Docker container, which includes all necessary tools, libraries, and dependencies for a project. It ensures a consistent development setup across different machines, simplifies onboarding, and enhances productivity by providing a pre-configured environment that mirrors production settings. DevContainers are commonly used with Visual Studio Code to streamline development workflows and improve collaboration.
To run DevContainers on a Windows machine for .NET and React development, the following dependencies must be met:
- Docker Desktop: Install Docker Desktop to enable containerization.
- Visual Studio Code: Install VS Code as the primary IDE.
- Install the VS Code extension 'ms-vscode-remote.remote-containers'
- .NET SDK: Ensure the .NET SDK is installed for .NET development.