# Setting Up Your Machine

This page walks through each install in more detail than the [Prerequisites](prerequisites.md) checklist.

## .NET 10 SDK

1. Download the .NET 10 SDK installer for your operating system from [dotnet.microsoft.com](https://dotnet.microsoft.com/download/dotnet/10.0). Choose the **SDK**, not the runtime.
2. Run the installer.
3. Open a new terminal (PowerShell, Command Prompt, or a shell) and confirm:

   ```bash
   dotnet --list-sdks
   ```

   ```output
   10.0.100 [C:\Program Files\dotnet\sdk]
   ```

4. Trust the HTTPS development certificate so the API runs over `https://localhost` without warnings:

   ```bash
   dotnet dev-certs https --trust
   ```

## EF Core tools

Module 2 uses the EF Core command-line tools to create migrations. Install them once as a global tool:

```bash
dotnet tool install --global dotnet-ef
dotnet ef --version
```

## Editor

Any of these work well for the workshop. Choose the one you already know.

+++ Visual Studio 2026
Install the **ASP.NET and web development** workload. `.http` files open in the built-in HTTP editor with a **Send Request** link above each request.
+++ VS Code
Install the **C# Dev Kit** extension. For `.http` files, install **REST Client** (by Huachao Mao). Optionally add **SQLite Viewer** to inspect the database.
+++ Rider
Rider includes C# support and an HTTP client for `.http` files out of the box.
+++

## Git and the workshop repo

```bash
git clone https://github.com/cwoodruff/aspnet-minimal-api-workshop.git
cd aspnet-minimal-api-workshop
git tag
```

You should see `start` and `checkpoint-1` through `checkpoint-5`. These tags are the backbone of the day:

- `start` is the empty starter, identical to the `src/00-start` project. Begin here.
- `checkpoint-N` is the code exactly as it stands at the end of Lab N.

During the day, if you fall behind or something breaks that you cannot fix in a minute, jump to the nearest checkpoint and keep going with the group:

```bash
git stash            # optional: keep your work to look at later
git checkout checkpoint-2
```

When you want to return to the branch you were building on, `git switch -` takes you back.

!!! warning Detached HEAD is expected
`git checkout checkpoint-2` leaves you on a tag, not a branch, so Git prints a "detached HEAD" notice. That is fine for following along. If you want to keep commits from a checkpoint, branch first with `git switch -c my-lab2 checkpoint-2`.
!!!

## The source layout

Everything you run during the day lives under `src/`, described in `src/README.md`:

| Project | What it is |
|---|---|
| `Roastery.Api` | The API you build all day |
| `Roastery.Payments` | A fake payment provider that fails ~30% of requests on purpose (Module 4) |
| `Roastery.Tests` | Integration tests (Module 4) |
| `Roastery.AppHost`, `Roastery.ServiceDefaults` | .NET Aspire orchestration (Module 5) |
| `00-start` | A frozen copy of the starting point for the environment check |

The `.http` request files for each module are in the `http/` folder at the repo root.

## Verify the whole thing builds

From the `start` tag (or any checkpoint), a full restore and build confirms your SDK and packages are healthy:

```bash
git checkout checkpoint-5     # the finished solution
dotnet build src/Roastery.slnx
dotnet test  src/Roastery.Tests
```

You should see a successful build and four passing tests. Then run the finished API to see where the day is headed:

```bash
dotnet run --project src/Roastery.Payments --launch-profile https   # https://localhost:7281
dotnet run --project src/Roastery.Api --launch-profile https        # https://localhost:7181
```

Run each in its own terminal. Without `--launch-profile https`, `dotnet run` picks the first profile (`http`) and listens only on the `http://localhost:51xx/52xx` ports, which the `.http` files do not use.

Browse to `https://localhost:7181/scalar/v1` for the API document, and sign in with a seed account (listed in `src/README.md`, e.g. `barista@roastery.dev` / `Barista1!`). When you are done exploring, `git switch -` returns you to your own branch.

## Docker Desktop or Podman (recommended)

Module 5 builds an OCI image with `dotnet publish` and runs it locally. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/) or [Podman](https://podman.io/) and confirm the daemon is running:

```bash
docker run --rm hello-world
```

The .NET Aspire AppHost also uses a container runtime when you swap in a Postgres resource during the Module 5 stretch goal.

## .NET Aspire

Module 5 uses .NET Aspire for local orchestration and the dashboard. The Aspire packages restore with the rest of the solution, but building and running the **AppHost** additionally needs the Aspire CLI (the dashboard and orchestrator bundle). Install it once:

+++ macOS / Linux
```bash
curl -sSL https://get.aspire.dev | bash
aspire --version
```
+++ Windows (PowerShell)
```powershell
iex "& { $(irm https://get.aspire.dev/install.ps1) }"
aspire --version
```
+++

Module 5 also creates the AppHost and ServiceDefaults projects from templates. Install them once:

```bash
dotnet new install Aspire.ProjectTemplates
dotnet new list aspire
```

You should see `aspire-apphost` and `aspire-servicedefaults` in the list.

To pre-cache the Aspire packages before the day, restore the finished solution once:

```bash
git checkout checkpoint-5
dotnet restore src/Roastery.slnx
```

The other four projects (API, Payments, Tests, ServiceDefaults) build and run without the Aspire CLI, so you can complete most of Module 5 even if this install gives you trouble; only running the AppHost and its dashboard depends on it.
