This template repo serves as a flavor of ready-to-go .NET and Azure development container.
Originally, this dev container was created to tryout .NET preview versions without having to install them locally.
Technically, this includes nothing but:
- .NET 7 Latest SDK and Azure CLI with Bicep
- Docker and Kubernetes with Helm Charts, and
- Configured to build and run from VS Code
See dev containers to get started at the most basic level, and:
- A GitHub account, and
- VS Code with recommended extensions
If you are completely new to .NET and C#, the .NET Learning Center is a good source of information. Or follow this generic pattern:
First you want a copy of this repo. It is marked as a Template
so you will only have to Use this template and follow the instructions. Read more about this in the GitHub's Template Repositories document.
With Dev Container CLI:
Just run devcontainer up devcontainers-try-dotnet-stuff/
in the repo. And that's it!
With VS Code:
First. run code devcontainers-try-dotnet-stuff/
in the repo to open in VS Code, and then it'll propmpt to Reopen in Container
. Do that and we're all set!
First, you want to ensure the repo is Reopened in Container
. Then you'll be able to work on .NET and Azure stuff like you would locally.
With VS Code:
- In a Terminal, run
dotnet --info
to see required versions are installed. - Run
az --version
to verify Azure CLI is installed.
Next, you would want to create a .NET project, say, a Minimal API test-project
that ships with .NET Template projects.
With VS Code:
-
Run
dotnet new
to create a new web api with specific template.dotnet new webapi -o src\test-project \ --use-minimal-apis \ --language "C#"
-
Open the launchSettings.json file, then change the
test_project
profile to run on port5000
for HTTP and5001
for HTTPS."profiles": { "test_project": { // ... "applicationUrl": "https://localhost:5001;http://localhost:5000", // ... }
VS Code is integrated with Omnisharp Tools to run the web api on the dev container.
With VS Code:
- Press
F5
to launch the web api project. Terminal shows the output from the Debug Console. - When the web api executes, visit localhost:5001/swagger on your favorite browser.
- Press
Ctrl
+C
to stop and disconnect the debugger.
- Dev Containers specification is a good source to learn more about
.devcontainer.json
configuration options and its usage. - See .NET CLI page to learn the full-blown
dotnet
options. - See Azure CLI page to learn what can be done with
az
andaz pipelines
. - See Azure DevOps CLI page to learn what can be done with
az devops
. - See .NET Docker Images for alternative versions as you wish.
If you have any technical problems with dev containers, you are better off asking Dev Containers Support directly, since you'll end up getting a much faster response back that way.
The official repo to contribute would be @devcontainers.
Have a suggestion or a bug fix? Just open a pull request or an issue. Include clear and simple instructions possible.
Copyright (c) Alertbox Inc. All rights reserved.
The source code is license under the MIT license.