Backend Development with .NET
Session 02
Environment Setup
& Git/GitHub
Eng. Seif Mansour  ·  Andalusia Academy
Week 1  ·  2 hours
Session Goals

By the end of this session, you will have:

  • A fully working .NET 8 development environment installed and verified
  • Git configured and a GitHub account connected to your local machine
  • A clear understanding of .NET-appropriate Git practices and project layout
  • Your first project repository created, committed, and pushed to GitHub
Session Agenda
Time Segment Type Duration
0:00Install & verify .NET SDKLab20 min
0:20IDE setup (VS Code or Rider)Lab15 min
0:35Postman setup & first requestDemo15 min
0:50Git essentials recapTheory15 min
1:05.NET-specific Git practicesTheory + Demo20 min
1:25Create repo, first commit, pushLab25 min
1:50Wrap-upDiscussion10 min
Dev Environment Setup
Install .NET 8, choose your IDE, and verify everything works before writing a single line of code
In this section
  • Download & install the .NET 8 SDK
  • Install the dotnet-ef global tool
  • IDE options: VS Code vs Rider
  • VS Code extensions for .NET
Installing .NET 8 SDK
  • Download from dot.net — choose .NET 8 (LTS)
  • Run the installer for your OS (Windows, macOS, Linux)
  • After install, restart your terminal to refresh the PATH
  • Verify the installation with the two commands shown
Why .NET 8?
.NET 8 is the current Long-Term Support release, supported until November 2026.
dotnet --version
dotnet --list-sdks

Expected: 8.x.x or higher. If the command is not found after install, restart the terminal — the PATH is updated on launch.

Install the dotnet-ef Global Tool
Terminal
dotnet tool install --global dotnet-ef

You will use this in Session 09 when Entity Framework Core migrations are introduced.

Tool not found after install?
Add the tools directory to your PATH. On Windows: %USERPROFILE%\.dotnet\tools  |  macOS / Linux: ~/.dotnet/tools
IDE Options
Recommended
VS Code
Lightweight, free, cross-platform. Needs a few extensions for .NET (covered on the next slide). Great for learning the toolchain explicitly — nothing is hidden.
JetBrains Rider
Full-featured .NET IDE, free for students. Better refactoring and integrated debugger than VS Code. Activate a free student license at jetbrains.com/student.
Course convention
Demos use VS Code. Both IDEs produce identical output — use whichever you prefer.
VS Code Extensions for .NET
  • C# Dev Kit (Microsoft) — IntelliSense, solution explorer, run & debug for C#. Installs the base C# extension automatically
  • NuGet Gallery — browse and add NuGet packages without leaving the editor
  • REST Client — send HTTP requests from .http files directly in the editor; lightweight alternative to Postman for quick endpoint tests
Install all three now
Extensions panel  Ctrl+Shift+X  → search each name → Install. Takes under two minutes.
Postman & API Testing
The tool you will use to call and inspect your API from Session 03 onward
In this section
  • Download & create a workspace
  • Make your first GET request
  • Environments, variables, collections
Postman Setup
  • Download from postman.com or use the web version — both work for this course
  • Create a workspace named Backend with .NET — one collection per session
  • Make a first request: GET https://httpbin.org/get — inspect the status code, headers, and JSON body
  • Environments — store variables such as baseUrl to switch between local and deployed without editing every request
  • Collections — group related requests; you will build these heavily from Session 04 onward
httpbin.org
A public echo API — it reflects your exact request back in the response body, which makes it ideal for learning HTTP.
Git Essentials Recap
Commands you already know — and one distinction you may not
In this section
  • Core workflow commands
  • Branching and pull requests
  • Merge vs Rebase
Core Git Workflow

From your frontend course — quick recap:

  • git init / git clone
  • git add / git commit
  • git push / git pull
  • git checkout -b feature/name
  • Opening a Pull Request on GitHub
# typical session workflow
git checkout -b feature/session-03

# ... make changes ...

git add .
git commit -m "feat: add task list endpoint"
git push origin feature/session-03
# open PR on GitHub → merge
Merge vs Rebase
git merge
  • Creates a merge commit
  • Preserves the full history of both branches
  • Safe on shared or public branches
  • Use for: integrating a feature branch into main
git rebase
  • Replays your commits onto the new base
  • Produces a clean, linear history
  • Rewrites commit SHAs — risky if already pushed
  • Use for: cleaning up a local feature branch before a PR
Rule of thumb
Never rebase a branch that others have already pulled. On a solo project, rebasing your local feature branch before merging is safe and keeps history clean.
.NET-Specific Git Practices
What you must configure before your first commit in a .NET project
In this section
  • Why .gitignore matters in .NET
  • Generate it with dotnet new gitignore
  • Secrets — never in source control
  • Branch strategy for the course
Why .gitignore Matters in .NET
  • Every dotnet build generates bin/ and obj/ output folders
  • These contain thousands of compiled files that change on every build — committing them bloats the repo and causes merge conflicts
  • Without a .gitignore, running git add . stages all of them
  • The .NET SDK ships a generator: dotnet new gitignore creates the correct ignore rules for the current project type
First commit rule
Always run dotnet new gitignore before your first git add . — never after.
Generate the .gitignore
Terminal — run from the solution root
dotnet new gitignore

Key entries generated for .NET projects:

  • bin/ — compiled output; changes on every build
  • obj/ — intermediate build artifacts; never needed in version control
  • *.user — per-developer IDE preference files
  • .vs/ — Visual Studio workspace state (Rider uses .idea/ instead)
Secrets — Never Commit
  • appsettings.Development.json is where connection strings and API keys typically live in .NET projects
  • The generated .gitignore does not include it — you must add it manually
  • If a secret is pushed: rotate it immediately, then remove it from history with git filter-repo
  • dotnet user-secrets is the proper local-secret store — covered in Session 19
# append to your .gitignore
appsettings.Development.json

# emergency: remove from tracking
# (still need to rotate the secret)
git rm --cached \
  appsettings.Development.json
If it reaches GitHub
Treat the secret as compromised — delete and regenerate it regardless of whether the repo is private.
Key Concept
"Set up the .gitignore before the first commit. A secret that reaches GitHub — even briefly — must be treated as compromised."
— Session 02
Recommended Branch Strategy
  • main — always working and deployable; never commit directly here
  • feature/session-XX — one branch per session's work; merged via PR when complete
  • Even when working solo, open a Pull Request and merge it — this builds the habit and provides a clean audit trail
  • Use conventional commit prefixes: feat:  fix:  docs:  chore:
Course convention
After each session lab: merge your feature/session-XX branch into main via a PR. This is exactly how professional teams operate.
Creating Your First Repository
Scaffold the project you will develop across all 20 sessions
What you will create

A TaskManagerApi .NET solution with a Web API project, a .gitignore, an initial commit, and a remote on GitHub — ready to build upon from Session 03 onward.

Project Scaffold — Step by Step
Terminal
mkdir TaskManagerApi
cd TaskManagerApi
dotnet new sln
dotnet new webapi -n TaskManagerApi.Api
dotnet sln add TaskManagerApi.Api
git init
dotnet new gitignore
git add .
git commit -m "feat: initial project scaffold"
git remote add origin https://github.com/<username>/task-manager-api.git
git push -u origin main

1–2: create the directory  ·  3–5: scaffold the .NET solution  ·  6–8: initialise Git  ·  9–11: first commit and push

Common Issues to Watch For
dotnet not found after install
On Windows, restart the terminal after installing the SDK — the PATH is only updated for new processes.
dotnet-ef not found
Add %USERPROFILE%\.dotnet\tools (Windows) or ~/.dotnet/tools (macOS/Linux) to your PATH, then restart the terminal.
appsettings.Development.json committed by mistake
Run git rm --cached appsettings.Development.json, add it to .gitignore, commit the fix — and rotate any secrets that were exposed.
Summary
  • The .NET 8 SDK is installed and verified — dotnet --version confirms it
  • VS Code with C# Dev Kit (or JetBrains Rider) provides full .NET development support
  • Always run dotnet new gitignore before the first commit to exclude bin/, obj/, and secrets
  • Merge is safe for integrating branches; rebase is for cleaning up local history — never rebase pushed branches
  • One feature branch per session merged via PR is the professional workflow, even solo
  • Your TaskManagerApi repository is live on GitHub and ready for Session 03
What's Next

Session 03 — First .NET Web API & Project Architecture

  • Build your first /tasks endpoint and return data from it
  • Understand how ASP.NET Core processes a request end-to-end
  • Organise the project into a layered architecture

Before next session:

  • Push the initial scaffold to GitHub — the repository must be live before Session 03 starts
  • Read through the generated .gitignore file and understand each entry
Assignment

Set Up Your Course Repository — complete independently after this session. You are done when all five criteria below are met.

  • A task-manager-api GitHub repository exists and is publicly accessible (or shared with the instructor)
  • A dotnet new gitignore-generated .gitignore is committed to the repository
  • bin/ and obj/ are not tracked — run dotnet build then git status to verify
  • The initial commit message is exactly feat: initial project scaffold
  • The main branch is pushed and visible on GitHub
Bonus
Create a feature/session-02 branch, add a README.md with the project name and a one-sentence description, commit with docs: add project readme, and open a pull request to main.
Questions?
Session 02 — Environment Setup & Git/GitHub