A sample C# project to work out the development environment.
This project was created using the dotnet new webapi .NET CLI command with the .NET Core 3.1 SDK.
Use the dotnet run command to run the project. To watch for changes run dotnet watch run.
The global.json file determines what .NET SDK should be used. This is similar in behaviour to a .nvmrc file. More information here: https://docs.microsoft.com/en-us/dotnet/core/versions/selection#the-sdk-uses-the-latest-installed-version
- VS Code: Working with C#
- VS Code: Using .NET Core in Visual Studio Code
- VS Code: Create a .NET console application using Visual Studio Code
- VS Code: Debug a .NET console application using Visual Studio Code
- Get started with VS Code using C# and .NET Core on Windows
- Containerize a .NET Core app
- Deploying to a Digital Ocean Droplet
The project can be started as a container. The Dockerfile is based heavily on the Dockerize an ASP.NET Core application article from Docker docs.
To create an image run docker build -t dotnet-test .
To run the image run docker run -d -p 8080:80 --name myapp dotnet-test
Or, with docker compose, run docker-compose up
Install: dotnet tool install --global dotnet-script
Create a script: dotnet script init hello
Runn the script: dotnet script hello.csx
C# scripts using dotnet-script
| node.js | .NET |
|---|---|
nodemon |
dotnet watch run |
npm start |
dotnet run |
npm build --production |
dotnet publish -c Release |
.nvmrc |
global.json |
npm i <package-name> |
dotnet add package <package-name> |
npm i <package-name>@<version> |
dotnet add package <package-name> -v <version> |
npm i |
dotnet restore |
nvm ls |
dotnet --list-sdks |
node test.js |
dotnet dotnettest.dll |
The app is configured to use Travis CI.
On a commit to main Travis will:
- build the latest image
- push this image to docker hub
- deploy this to image to AWS Elastic Beanstalk