-
Install repo and SDK
- sudo apt update
- sudo apt upgrade
- wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
- sudo dpkg -i packages-microsoft-prod.deb
- rm packages-microsoft-prod.deb
- sudo apt update
- sudo apt upgrade
- sudo apt-get install -y dotnet-sdk-7.0
-
Install C# plugin for vscode
-
dotnet new gitignore
-
dotnet new tool-manifest
-
Scaffold the type of app you want
- dotnet new sln
- dotnet new console --output [<foldername/namespace>] --framework net7.0 //console app
- dotnet new classlib --output [<foldername/namespace>] --framework net7.0 //class library app
- dotnet new mstest --output [<foldername/namespace>] //unit test app
- after adding your various projects need to now add them to the solution you oringally created
- dotnet sln add [<foldername/namespace>]/[<foldername/namespace>].csproj
- to reference a classlib in a console/desktop app
- dotnet add []/[].csproj reference []/[].csproj
- in the case of test projects...
- dotnet add []/[].csproj reference [/].csproj
- Run test: dotnet test [/].csproj
-
CRTL+SHIFT+P. In command palette type ">.NET: Generate Assets for Build and Debug".
-
dotnet run // run source code
-
dotnet run --project [] eg. dotnet run --project day01
-
dotnet publish -c release -r ubuntu.16.04-x64 --self-contained // compile console app as "executable"
dotnet new editorconfig
add the below to .vscode/settings.json { "omnisharp.enableRoslynAnalyzers": true, "omnisharp.enableEditorConfigSupport": true }
change .editorconfig to contain only
root = true
[*.cs]
dotnet_analyzer_diagnostic.category-Style.severity = warning
dotnet_diagnostic.IDE0003.severity = none
dotnet_diagnostic.IDE0008.severity = none
dotnet_diagnostic.IDE0058.severity = none
dotnet_diagnostic.IDE0160.severity = none
add "true" to .csproj file.
dotnet new sln dotnet new console --output day01 --name day01 --framework net8.0 dotnet sln add day01/day01.csproj dotnet run --project day01
// Add a package from nuget to a project dotnet add [] package [] dotnet add day24 package Microsoft.Z3 --version 4.11.2 // used this to install the Z3 v 4.11.2 solver for day 24
// Remove a package installed with nuget to a project dotnet remove [] package []
// List packages in a project dotnet list [] package