-
Fork this repository into your user account (using Fork option on top right of the screen). This repository will get forked as /codespaces-workshop. This repository contains a sample REST API implemented via dotnet core
-
Then click on the Code drop down, you will see the option "Open with codespaces"
It will take few minutes to create a workspace. -
You will see a VS-Code editor with your project.
You now have a working dev environment in the browser to start development 🎉 -
Open the terminal from the editor's bottom pane
-
Execute
dotnet run --project src/weatherforecast.api
-
Now click on the
http://localhost:5000
link in the terminal output and see the magic of port forwarding, allowing you to access your codespace dev box.
However, you should be seeing nothing in the page as we don't have any index page yet. Just append the URL with the/weatherforecast
-
You would see the REST API output in the browser
Making Code change and debug
Create branch and raise pull request
Merge the changes
GitHub Documentation Link
GitHub Documentation Link
Option1
- Go here
- Download the repository
- Copy the folder from
<repo>/containers/dotnet-mssql/.devcontainer
to your project root folder - Open command palette in the browser (right click or cmd/ctrl+SHIFT+P)
- Run the command
Codespaces: ReBuild Container
This step will rebuild the codespace according to our specification in the devcontainer.json - Now check the VS Code extensions, you should have SQL Server extension with the connection and an empty database
ApplicationDB
Option2 (Recommonded) : You can add the devcontainer configuration using a VSCode command
- Open command pallette
- Run the Command
Codespaces: Add Development Container Configuration Files
- Type in the
MS SQL
in the search box - Click on
Show All Definition
- Select C# & MS SQL and you are done !
- You will see bunch of files created in your repo root under
.devcontainer
folder
To read more details on available dev container here
Personalizing for your account
-
Codespaces uses your
dotfiles
repository on GitHub to personalize every new codespace that you create More details here -
VSCode Settings Sync. Read more here for enabling the settings sync.
Security GitHub Documentation for codespaces security
Secrets GitHub documentation for managing encrypted secrets for codespaces
All our codespaces secrets will be loaded as the Environment variables in the codespace environment.