Skip to content

github-education-resources/codespaces-teaching-template-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Open in GitHub Codespaces

.NET Codespaces Template

Extend and use for your Web Development lessons in minutes.

This .NET Codespaces template provides you a normalized environment for you to build your class on. No setup time needed from you or your students, allowing you to focus on the content and lessons.

  • Who is this for? Educators of all levels.
  • How much experience do students need? Zero. This template is built with basic elements complete with comments so it can be used in beginner to advanced lessons.
  • Can I use this template for other .NET applications? Absolutely. This template uses ASP.NET web app and API app as examples.
  • Prerequisites: None. This template will provide a working and deployable web app and API app you can immediately extend for your needs.
πŸŽ₯ Watch the video tutorial to learn more about Codespaces

Codespaces Tutorial

πŸš€ Codespaces features:

  • Repeatable cloud environment offering a push-button experience.
  • Can be configured and customized.
  • Integrates with your repositories on GitHub and Visual Studio Code.

As a teacher that means that you can create an environment, in the cloud, for your class that all students can use with zero or next to zero configuration regardless of what operating system they are using.

πŸ§‘β€πŸ« What is GitHub Codespaces and how can I use it in my teaching?

A Codespace is a development environment that's hosted in the cloud that you can configure. The Codespaces Education benefit gives Global Campus teachers a free monthly allowance of GitHub Codespaces hours to use in GitHub Classroom. Learn more here about Using GitHub Codespaces with GitHub Classroom.

If you are not already a Global Campus teacher, apply here or for more information, see Apply to GitHub Global Campus as a teacher.

πŸ” What is in this template?

This template repository contains:

  • .devcontainer settings:
    • Dockerfile: defines the devcontainer image for GitHub Codespaces that determines the operating system and .NET version.
    • devcontainer.json: declares the devcontainer configuration for GitHub Codespaces including extensions and tools to be pre-installed, and workspace settings.
    • post-create.sh: describes additional tools to be pre-installed.
  • ASP.NET web app: A sample web app
  • ASP.NET API app: A sample API app
  • README: this file – describes this repository and what's in it.

πŸš€ Getting Started

  1. Create a repository from this template. Use this create repo link. You can make the repository private or public, up to you.

  2. Navigate to the main page of the newly created repository.

  3. Under the repository name, use the Code drop-down menu, and in the Codespaces tab, select "Create codespace on main".

    Create codespace

  4. Wait as Github initializes the codespace:

    Creating codespace

πŸ› οΈ Customization

Customize your project for GitHub Codespaces by committing configuration files to your repository (often known as Configuration-as-Code), which creates a repeatable Codespaces configuration for all users of your project.

You can configure things like:

  • Extensions, you can specify what extensions should be preinstalled.
  • Dotfiles and settings.
  • Operating system libraries and dependencies

πŸ’‘ Learn more about customization and configuration in the official documentation

Customization on devcontainer.json

Base Image

By default, this devcontainer settings uses the base image of .NET 8.0 on Ubuntu LTS 22.04 by default. You can change the base image to one in the list.

"build": {
  "dockerfile": "./Dockerfile",
  "context": ".",
  "args": {
    "VARIANT": "8.0-jammy"
  }
}

Features

  1. Azure CLI: Uncomment the section under the features attribute.

    "features": {
      ...
      "ghcr.io/devcontainers/features/azure-cli:1": {
        "version": "latest"
      }
      ...
    },
  2. GitHub CLI: Uncomment the section under the features attribute.

    "features": {
      ...
      "ghcr.io/devcontainers/features/github-cli:1": {
        "version": "latest"
      }
      ...
    },
  3. node.js: Uncomment the section under the features attribute. The latest LTS version of node.js is chosen by default.

    "features": {
      ...
      "ghcr.io/devcontainers/features/node:1": {
        "version": "lts",
        "nodeGypDependencies": true,
        "nvmInstallPath": "/usr/local/share/nvm"
      }
      ...
    },

πŸ” If you want to add more features, find this repository: devcontainer features.

Extensions

  1. There are optional extensions pre-installed under the customizations.vscode.extensions attribute.

    "customizations": {
      "vscode": {
        "extensions": [
          "GitHub.copilot",
          "GitHub.copilot-chat",
          "ms-dotnettools.csdevkit",
          "ms-vscode.PowerShell",
          "ms-vscode.vscode-node-azure-pack",
          "VisualStudioExptTeam.vscodeintellicode"
        ],
        ...
      }
    }

πŸ” Alternatively, you can add as many extra extensions as you like, from Visual Studio Code Marketplace.

Customization on on-create.sh

You can pre-install any tool through on-create.sh, which the devcontainer features don't natively support yet. eg) PowerShell.

  1. If you want to install oh-my-posh for PowerShell, uncomment the section below

    ## OH-MY-POSH ##
    # Uncomment the below to install oh-my-posh
    sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
    sudo chmod +x /usr/local/bin/oh-my-posh

πŸ” There are more customization scenarios in on-create.sh, if you like to follow.

πŸ“š Resources

πŸ”Ž Found an issue or have an idea for improvement?

Help us make this template repository better by letting us know and opening an issue!.