Skip to content

Latest commit

 

History

History
77 lines (59 loc) · 2.73 KB

README_SETUP..md

File metadata and controls

77 lines (59 loc) · 2.73 KB
  1. Install repo and SDK

    1. sudo apt update
    2. sudo apt upgrade
    3. wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    4. sudo dpkg -i packages-microsoft-prod.deb
    5. rm packages-microsoft-prod.deb
    6. sudo apt update
    7. sudo apt upgrade
    8. sudo apt-get install -y dotnet-sdk-7.0
  2. Install C# plugin for vscode

  3. dotnet new gitignore

  4. dotnet new tool-manifest

  5. Scaffold the type of app you want

    1. dotnet new sln
    2. dotnet new console --output [<foldername/namespace>] --framework net7.0 //console app
    3. dotnet new classlib --output [<foldername/namespace>] --framework net7.0 //class library app
    4. dotnet new mstest --output [<foldername/namespace>] //unit test app
    5. after adding your various projects need to now add them to the solution you oringally created
      1. dotnet sln add [<foldername/namespace>]/[<foldername/namespace>].csproj
    6. to reference a classlib in a console/desktop app
      1. dotnet add []/[].csproj reference []/[].csproj
      2. in the case of test projects...
        1. dotnet add []/[].csproj reference [/].csproj
        2. Run test: dotnet test [/].csproj
  6. CRTL+SHIFT+P. In command palette type ">.NET: Generate Assets for Build and Debug".

  7. dotnet run // run source code

  8. dotnet run --project [] eg. dotnet run --project day01

  9. dotnet publish -c release -r ubuntu.16.04-x64 --self-contained // compile console app as "executable"

Linting

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

Optional

// 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