├── docs ├── illustrasjoner │ ├── redoc.png │ ├── solution-explorer.png │ └── dotnet-arkitektur.drawio.svg ├── en │ ├── tips-and-tricks.md │ ├── what-is--fsharp.md │ ├── what-is-dotnet.md │ └── setup-details.md ├── tips-og-triks.md ├── hva-er-fsharp.md ├── hva-er-dotnet.md └── detaljer-oppsett.md ├── LICENCE └── presentations └── 2025-02-26-nnug.md /docs/illustrasjoner/redoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrkno/dotnetskolen/HEAD/docs/illustrasjoner/redoc.png -------------------------------------------------------------------------------- /docs/illustrasjoner/solution-explorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrkno/dotnetskolen/HEAD/docs/illustrasjoner/solution-explorer.png -------------------------------------------------------------------------------- /docs/en/tips-and-tricks.md: -------------------------------------------------------------------------------- 1 | # 💡 Tips and tricks 2 | 3 | - Several people have reported that their IDEs are showing compilation errors in the editor after adding new dependencies or creating new modules. If the project builds successfully, either using the IDE's built-in build function or by running `dotnet build`, but such errors are still showing in the editor, reloading the solution may help: 4 | - Rider - right-click on the "Solution" node (`Dotnetskolen`), and select `Reload projects` 5 | - Visual Studio - right-click on the current project, select `Unload project`. Right-click on the current project again, and select `Reload project`. 6 | - Visual Studio Code - close the editor, run `dotnet clean` followed by `dotnet build` from the terminal, and reopen the application 7 | -------------------------------------------------------------------------------- /docs/tips-og-triks.md: -------------------------------------------------------------------------------- 1 | # 💡 Tips og triks 2 | 3 | - Flere har meldt om at de har slitt med at IDE-ene deres viser kompileringsfeil i editoren etter de har lagt til nye avhengigheter eller opprettet nye moduler. Dersom prosjektet bygger vellykket, enten ved hjelp av IDE-en sin innebygde byggfunksjon eller ved å kjøre `dotnet build`, men slike feil fortsatt vises i editoren, kan det hjelpe å laste løsningen på nytt: 4 | - Rider - høyreklikk på "Solution"-noden (`Dotnetskolen`), og velg `Reload projects` 5 | - Visual Studio - høyreklikk på det aktuelle prosjektet, velg `Unload project`. Høyreklikk på det aktuelle prosjektet på nytt, og velg `Reload project`. 6 | - Visual Studio Code - lukke editoren, kjøre `dotnet clean` etterfulgt av `dotnet build` fra terminalen, og åpne programmet på nytt 7 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Heidi Mork, Thomas Wolff 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /docs/hva-er-fsharp.md: -------------------------------------------------------------------------------- 1 | # Hva er F#? 2 | 3 | F# er et funksjonelt programmeringsspråk for .NET, og er mye brukt i NRK TV og NRK Radio siden språkets typesystem egner seg godt til å drive modellering i [domenedrevet design](https://en.wikipedia.org/wiki/Domain-driven_design). Når man installerer [.NET SDK](./hva-er-dotnet.md) følger kompilator for F# med, og man kan dermed utvikle og kjøre F#-kode. Som nevnt i innledningen skal all koding i dette kurset gjøres i F#. 4 | 5 | Dersom F# er nytt for deg, eller du ønsker å friske opp minnet om språket finner du noen nyttige lenker under: 6 | 7 | - Innføring i syntaks 8 | - F# cheat sheet: [http://dungpa.github.io/fsharp-cheatsheet/](http://dungpa.github.io/fsharp-cheatsheet/) 9 | - F# på 60 sekunder: [https://fsharpforfunandprofit.com/posts/fsharp-in-60-seconds/](https://fsharpforfunandprofit.com/posts/fsharp-in-60-seconds/) 10 | - [https://fsharpforfunandprofit.com](https://fsharpforfunandprofit.com) 11 | - Nettsted laget av Scott Wlaschin, med mange utfyllende og forklarende artikler om F# og funksjonell programmering. 12 | - For mer utfyllende innføring i F# se: [https://fsharpforfunandprofit.com/site-contents/#understanding-f](https://fsharpforfunandprofit.com/site-contents/#understanding-f) 13 | -------------------------------------------------------------------------------- /docs/en/what-is--fsharp.md: -------------------------------------------------------------------------------- 1 | # What is F#? 2 | 3 | F# is a functional programming language for .NET, and is widely used in NRK TV and NRK Radio since the language's type system is well suited for modeling in [domain-driven design](https://en.wikipedia.org/wiki/Domain-driven_design). When you install the [.NET SDK](what-is-dotnet.md) a compiler for F# is included, and you can thus develop and run F# code. As mentioned in the introduction, all coding in this course will be done in F#. 4 | 5 | If F# is new to you, or you want to refresh your memory, you will find some useful links below: 6 | 7 | - Introduction to the syntax 8 | - F# cheat sheet: [http://dungpa.github.io/fsharp-cheatsheet/](http://dungpa.github.io/fsharp-cheatsheet/) 9 | - F# in 60 seconds: [https://fsharpforfunandprofit.com/posts/fsharp-in-60-seconds/](https://fsharpforfunandprofit.com/posts/fsharp-in-60-seconds/) 10 | - [https://fsharpforfunandprofit.com](https://fsharpforfunandprofit.com) 11 | - Website created by Scott Wlaschin, with many complementary and explanatory articles about F# and functional programming. 12 | - For a more comprehensive introduction to F# see: [https://fsharpforfunandprofit.com/site-contents/#understanding-f](https://fsharpforfunandprofit.com/site-contents/#understanding-f) 13 | -------------------------------------------------------------------------------- /presentations/2025-02-26-nnug.md: -------------------------------------------------------------------------------- 1 | Welcome to the school of .NET! 2 | ======================== 3 | 4 | Introduction 5 | ------------ 6 | ### Welcome! 7 | - We're Heidi, Matias & Teodor 👋 8 | - Shutout to Thomas! (By him a beer at TDC 🍻) 9 | - How did this workshop come about? 10 | 11 | ### Learning goals 12 | This F# workshop is a bit different, in that it focuses on illustrating "real world" use of F#, over diving into the intricacies of the F# language. By participating in the workshop, we hope that you'll learn about: 13 | - How to create .NET APIs with F# and ASP.NET Core. 14 | - How to structure code with F# modules. 15 | - How to leverage F# in order to create domain models, and validate data into domain models. 16 | - How to create unit and integration tests with F#. 17 | 18 | ### Agenda 19 | - 17:00 - Introduction to the workshop 20 | - 17:10 - Workshop start 21 | - 18:15 - Epilogue 22 | 23 | ### Where to start? 24 | The workshop have different [alternative starting points](https://github.com/nrkno/dotnetskolen/blob/main/README_EN.md#-alternative-starting-points). Your free to pick the starting point that best suits your interests, and level of .NET experience. 25 | 26 | For beginners, we recommend starting with [Project and solution setup with .NET CLI](https://github.com/nrkno/dotnetskolen/blob/main/README_EN.md#project-and-solution-setup-with-net-cli), and then following each step in sequence. 27 | 28 | For more experienced .NET developers, we suggest starting with [Domain Modeling and Unit Tests](https://github.com/nrkno/dotnetskolen/blob/main/README_EN.md#domain-modeling-and-unit-tests). 29 | 30 | #### Solution suggestions 31 | Each step in the workshop, have a corresponding branch, containing a solution suggestion with all code required to complete that step. The branches have the format `en/step-n` or `steg-n`, where n is the step-number, and `en/` indicates that the solution suggestion is written in English. 32 | 33 | The solution suggestions can be used in two ways: 34 | 1. If you're stuck working on a given workshop step, you can use the corresponding solution suggestion to guide your work. 35 | 2. If you're starting from one of the later steps in the workshop, you can check out the solution suggestion to the previous step, in order to get a starting point. 36 | 37 | Epilogue 38 | -------- 39 | - Quick question to the room: How did it go? 40 | - Did F# leave you with any particular impressions? 41 | - Were the steps easy to follow? 42 | - Stories about starting with F# at work 43 | - The one about writing the domain model in F# 44 | - The one about writing F# tests 45 | - Any questions? 46 | 47 | -------------------------------------------------------------------------------- /docs/hva-er-dotnet.md: -------------------------------------------------------------------------------- 1 | # Hva er .NET? 2 | 3 | .NET er en plattform for å utvikle og kjøre applikasjoner, og består av flere ting: 4 | 5 | - Programmeringsspråk - som f.eks. C# og F# 6 | - Kompilatorer - programmer som kompilerer kode skrevet i et .NET-programmeringsspråk til CIL ("common intermediate language") 7 | - CIL ("common intermediate language") - et felles lavnivåspråk som all .NET-kode blir kompilert til 8 | - CLR ("common language runtime") - kjøretidsmiljø for .NET-programmer som oversetter instruksjonene definert i CIL til maskinkode, og kjører maskinkoden 9 | - BCL ("base class library") - en stor samling biblioteker skrevet av Microsoft som tilbyr standard funksjonalitet som f.eks. datastrukturer (lister, datoer etc.), IO (lesing og skriving av filer, nettverkshåndtering) og sikkerhet (kryptering, sertifikater). 10 | 11 | ![dotnet-arkitektur](./illustrasjoner/dotnet-arkitektur.drawio.svg) 12 | 13 | ## Versjoner av .NET 14 | 15 | Opprinnelig var .NET kun tilgjengelig på Windows. Denne versjonen av .NET omtales som .NET Framework. Etter hvert kom implementasjoner av kjøretidsmiljøet til andre plattformer også, som Mono til Linux og Mac, og Xamarin til Android og iOS. Både Mono og Xamarin var opprinnelig drevet av andre selskaper enn Microsoft. I 2016 lanserte Microsoft en ny versjon av .NET, .NET Core, som er en implementasjon av .NET for alle plattformer (Windows, Mac og Linux). .NET Core gikk gjennom tre hovedversjoner, i parallell med .NET Framework som nådde sin siste versjon, 4.8, i 2019. .NET Framework blir ikke videreutviklet, og i 2020 lanserte Microsoft .NET 5 som er den versjonen Microsoft vil fortsette å utvikle fremover. I skrivende stund (2025-01-30) er .NET 9 den nyeste versjonen av .NET. 16 | 17 | For å definere hva som er tilgjengelig i de ulike versjonene av .NET har Microsoft laget en spesifikasjon, .NET Standard. .NET Standard har flere versjoner, og de ulike versjonene av .NET (.NET Framework, .NET Core, Mono etc.) følger spesifikasjonen i en gitt versjon av .NET Standard. Les mer om .NET Standard, og kompatibilitet på tvers av .NET-versjoner her: [https://docs.microsoft.com/en-us/dotnet/standard/net-standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 18 | 19 | ## Kilder 20 | 21 | - [https://www.mono-project.com/](https://www.mono-project.com/) 22 | - [https://en.wikipedia.org/wiki/.NET_Core](https://en.wikipedia.org/wiki/.NET_Core) 23 | - [https://en.wikipedia.org/wiki/.NET_Framework](https://en.wikipedia.org/wiki/.NET_Framework) 24 | - [https://en.wikipedia.org/wiki/Common_Intermediate_Language](https://en.wikipedia.org/wiki/Common_Intermediate_Language) 25 | - [https://docs.microsoft.com/en-us/dotnet/standard/clr](https://docs.microsoft.com/en-us/dotnet/standard/clr) 26 | - [https://dotnet.microsoft.com/apps/xamarin](https://dotnet.microsoft.com/apps/xamarin) 27 | -------------------------------------------------------------------------------- /docs/en/what-is-dotnet.md: -------------------------------------------------------------------------------- 1 | # What is .NET? 2 | 3 | .NET is a platform for developing and running applications, and consists of several things: 4 | 5 | - Programming languages ​​- such as C# and F# 6 | - Compilers - programs that compile code written in a .NET programming language to CIL ("common intermediate language") 7 | - CIL ("common intermediate language") - a common low-level language that all .NET code is compiled into 8 | - CLR ("common language runtime") - the runtime environment for .NET programs that translates the instructions defined in CIL into machine code, and runs the machine code 9 | - BCL ("base class library") - a large collection of libraries written by Microsoft providing standard functionality such as data structures (lists, dates, etc.), IO (reading and writing files, network management) and security (encryption, certificates). 10 | 11 | ![dotnet-architecture](./illustrations/dotnet-architecture.drawio.svg) 12 | 13 | ## Versions of .NET 14 | 15 | Originally, .NET was only available on Windows. This version of .NET is referred to as the .NET Framework. Implementations of the runtime environment were eventually ported to other platforms as well, such as Mono for Linux and Mac, and Xamarin for Android and iOS. Both Mono and Xamarin were originally developed by companies other than Microsoft. In 2016, Microsoft released a new version of .NET, .NET Core, which is an implementation of .NET for all platforms (Windows, Mac, and Linux). .NET Core went through three major versions, in parallel with the .NET Framework, which reached its latest version, 4.8, in 2019. The .NET Framework is no longer being developed, and in 2020, Microsoft released .NET 5, which is the version Microsoft will continue to develop going forward. At the time of writing (2025-01-30), .NET 9 is the latest version of .NET. 16 | 17 | To define what is available in the different versions of .NET, Microsoft has created a specification, .NET Standard. .NET Standard has several versions, and the different versions of .NET (.NET Framework, .NET Core, Mono etc.) follow the specification of a given version of .NET Standard. Read more about .NET Standard, and compatibility across .NET versions here: [https://docs.microsoft.com/en-us/dotnet/standard/net-standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 18 | 19 | ## References 20 | 21 | - [https://www.mono-project.com/](https://www.mono-project.com/) 22 | - [https://en.wikipedia.org/wiki/.NET_Core](https://en.wikipedia.org/wiki/.NET_Core) 23 | - [https://en.wikipedia.org/wiki/.NET_Framework](https://en.wikipedia.org/wiki/.NET_Framework) 24 | - [https://en.wikipedia.org/wiki/Common_Intermediate_Language](https://en.wikipedia.org/wiki/Common_Intermediate_Language) 25 | - [https://docs.microsoft.com/en-us/dotnet/standard/clr](https://docs.microsoft.com/en-us/dotnet/standard/clr) 26 | - [https://dotnet.microsoft.com/apps/xamarin](https://dotnet.microsoft.com/apps/xamarin) 27 | -------------------------------------------------------------------------------- /docs/detaljer-oppsett.md: -------------------------------------------------------------------------------- 1 | # 📜 Detaljer om oppsett på maskinen din 2 | 3 | Dette kurset forutsetter at du har noen verktøy installert på maskinen din. Se gjennom listen under for å sørge for at du har det som trengs. 4 | 5 | > Å installere og bruke Git er valgfritt, men er kjekt å ha dersom du ønsker å ha veiledningen, og [løsningsforslag](https://github.com/nrkno/dotnetskolen#se-l%C3%B8sningsforslag), lokalt på maskinen din. 6 | 7 | ## 🛠️ Verktøy 8 | 9 | For å gjennomføre kurset må du ha satt opp følgende: 10 | 11 | - [.NET SDK](#NET-SDK) 12 | - [Konfigurasjon av NuGet (kun for Windows)](#konfigurere-nuget-kun-for-windows) 13 | - [En IDE](#IDE) 14 | - [Rider](https://www.jetbrains.com/rider/download) 15 | - [Visual Studio](https://visualstudio.microsoft.com/vs/community) 16 | - [Visual Studio Code](https://code.visualstudio.com/download) 17 | - [Git (valgfritt)](#Git) 18 | 19 | ### .NET SDK 20 | 21 | Når man installerer .NET har man valget mellom å installere 22 | 23 | - .NET runtime - kjøretidsmiljø for .NET-applikasjoner 24 | - .NET SDK - inneholder alt man trenger for å utvikle og kjøre .NET-applikasjoner lokalt, og inkluderer 25 | - .NET runtime og basebiblioteker (BCL) 26 | - Kompilatorer 27 | - .NET CLI - kommandolinjeverktøy for å bygge, kjøre og publisere .NET-applikasjoner 28 | 29 | Ettersom du gjennom kurset skal utvikle og kjøre .NET-applikasjoner trenger du .NET SDK installert på maskinen din. Kurset er laget med .NET 9, men de fleste kommandoene fungerer nok med en versjon av .NET Core, og vil trolig være tilgjengelig i fremtidige versjoner også. Du kan undersøke hvilken versjon av .NET du har lokalt (om noen i det hele tatt) ved å kjøre følgende kommando 30 | 31 | ```bash 32 | dotnet --version 33 | ``` 34 | 35 | ```bash 36 | 9.0.102 37 | ``` 38 | 39 | Dersom du ikke har .NET installert på maskinen din, kan du laste det ned her: [https://dotnet.microsoft.com/download/dotnet](https://dotnet.microsoft.com/download/dotnet) 40 | 41 | Som nevnt over inkluderer .NET SDK også .NET CLI som gir oss muligheten til å bygge, kjøre og publisere .NET-applikasjoner. Etter å ha installert .NET CLI kan man kjøre `dotnet`-kommandoer i terminalen. For at kurset skal kunne gjennomføres uavhengig av plattform og IDE skal vi bruke .NET CLI til oppsett av løsningen vår. 42 | 43 | Veiledningen forklarer det grunnleggende om kommandoene vi kommer til å bruke i .NET CLI. Dersom du ønsker mer utfyllende informasjon eller oversikt over alle kommandoene kan du lese mer om .NET CLI her: [https://docs.microsoft.com/en-us/dotnet/core/tools/](https://docs.microsoft.com/en-us/dotnet/core/tools/) 44 | 45 | ### Konfigurere NuGet (kun for Windows) 46 | 47 | I .NET bruker man "NuGet"-pakker for å dele kode mellom prosjekter. NuGet har et offentlig repo med pakker som er tilgjengelig på [https://www.nuget.org/](https://www.nuget.org/). Dersom du ikke har brukt NuGet på Windows-maskinen din før kan det være at du må instruere NuGet til å hente pakker derfra. 48 | 49 | Åpne filen `C:/Users//AppData/Roaming/NuGet/NuGet.Config`, og lim inn følgende innhold: 50 | 51 | ```xml 52 | 53 | 54 | 55 | 56 | 57 | 58 | ``` 59 | 60 | ### IDE 61 | 62 | For å kunne debugge kode, få syntax highlighting og visning av kompileringsfeil, autocomplete, og kodenavigering er det kjekt å ha en IDE. De mest brukte IDE-ene for .NET er oppsummert i tabellen under. 63 | 64 | | Navn | Plattform | Lisens | Download | 65 | | - | - | - | - | 66 | | Visual Studio|Windows | Community-versjon er gratis. Øvrige versjoner krever lisens. |[https://visualstudio.microsoft.com/vs/community](https://visualstudio.microsoft.com/vs/community)| 67 | | Visual Studio Code | Kryssplattform | Gratis | [https://code.visualstudio.com/download](https://code.visualstudio.com/download) | 68 | | Rider | Kryssplattform | Gratis i 30 dager. Deretter kreves lisens. | [https://www.jetbrains.com/rider/download](https://www.jetbrains.com/rider/download) | 69 | 70 | Velg den IDE-en som passer dine behov. 71 | 72 | > Dersom du skal bruke Visual Studio Code, anbefales det å installere pluginen "Ionide". 73 | > 74 | > - Du kan laste ned Ionide her: [https://docs.microsoft.com/en-us/dotnet/fsharp/get-started/get-started-vscode](https://docs.microsoft.com/en-us/dotnet/fsharp/get-started/get-started-vscode) 75 | > - Du kan lese mer om Ionide her: [https://ionide.io/](https://ionide.io/) 76 | 77 | > Merk at et vanlig use case for IDE-er er at de også blir brukt til å kompilere og kjøre kode. Instruksjonene i kurset kommer imidlertid til å benytte .NET CLI til dette. Du står selvfølgelig fritt frem til å bygge og kjøre koden ved hjelp av din IDE hvis du ønsker det. 78 | 79 | ### Git 80 | 81 | Git er et gratis versjonshåndteringssystem som finnes til alle plattformer. Dersom du ønsker å ha instruksjonene til kurset (dokumentet du leser nå), eller se forventet resultat etter å ha gjennomført hvert av de ulike stegene, på din egen maskin, trenger du Git installert. Med Git kan du også lage din egen versjon av dette repoet slik som forklart [her](#sjekke-ut-egen-branch). 82 | 83 | Du kan laste ned Git her: [https://git-scm.com/downloads](https://git-scm.com/downloads). 84 | 85 | Dersom Git er nytt for deg kan det være nyttig å lese denne artikkelen om hvordan man jobber med endringer i et Git-repo: [https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository). Det er forøvrig instruksjoner på [slutten av første steg](https://github.com/nrkno/dotnetskolen#lagre-endringer-i-git-valgfritt) for hvordan du kan lagre endringer du gjør underveis i kurset i Git. 86 | 87 | ## 💻 Lokalt oppsett av koden (valgfritt) 88 | 89 | ### Klone repo 90 | 91 | Dersom du ønsker dette repoet lokalt på din maskin, kan forke dette repoet til din egen bruker ved å følge denne guiden: . Deretter kan du klone det, slik: 92 | 93 | ```bash 94 | git clone git@github.com:/dotnetskolen.git # Last ned repo fra GitHub til din maskin 95 | ``` 96 | 97 | ```bash 98 | Cloning into 'dotnetskolen'... 99 | remote: Enumerating objects: 9, done. 100 | remote: Counting objects: 100% (9/9), done. 101 | remote: Compressing objects: 100% (5/5), done. 102 | remote: Total 9 (delta 2), reused 4 (delta 1), pack-reused 0 103 | Receiving objects: 100% (9/9), done. 104 | Resolving deltas: 100% (2/2), done. 105 | ``` 106 | 107 | > Kommandoen over forutsetter at man bruker SSH for autentisering overfor GitHub. For mer informasjon om SSH-autentisering i GitHub se 108 | > 109 | > Dersom man ønsker å klone med HTTPS istedenfor må man kjøre kommandoen over med denne URL-en istedenfor: `https://github.com//dotnetskolen.git`, og oppgi brukernavn og passord. 110 | > 111 | > Ev. kan man bruke [GitHub sin desktopklient](https://desktop.github.com/) 112 | 113 | Da skal nå ha `main`-branchen sjekket ut lokalt på din maskin. Det kan du verifisere ved å gå inn i mappen til repoet og liste ut branchene i Git: 114 | 115 | ```bash 116 | cd dotnetskolen # Gå inn i mappen som repoet ligger i lokalt 117 | git branch # List ut alle brancher du har sjekket ut lokalt 118 | ``` 119 | 120 | ```bash 121 | * main 122 | ``` 123 | 124 | ### Sjekke ut egen branch 125 | 126 | Før du begynner å kode kan du gjerne lage din egen branch med `git checkout -b `. På denne måten kan du holde dine endringer adskilt fra koden som ligger i repoet fra før, og det er lettere for kursholder å hjelpe deg dersom du har behov for det. 127 | 128 | ```bash 129 | git checkout -b my-branch 130 | ``` 131 | 132 | ```bash 133 | Switched to a new branch 'my-branch' 134 | ``` 135 | 136 | ### Sette opp .gitignore 137 | 138 | Vanligvis er det en del filer man ikke ønsker å ha inkludert i Git. Dette er noe man fort merker ved etablering av et nytt system. For å fortelle Git hvilke filer man vil ignorere, oppretter man en `.gitignore`-fil i roten av repoet. 139 | 140 | GitHub har et eget repo som inneholder `.gitignore`-filer for ulike typer prosjekter: [https://github.com/github/gitignore](https://github.com/github/gitignore). `.gitignore`-filene GitHub har utarbeidet inneholder filtypene det er vanligst å utelate fra Git for de ulike prosjekttypene. Ettersom dette kurset omhandler .NET kan vi bruke `VisualStudio.gitignore` fra repoet deres. 141 | 142 | For å sette opp `.gitignore` i ditt lokale repo: 143 | 144 | 1. Opprett en tekstfil med navn `.gitignore` i roten av repoet 145 | 2. Lim inn innholdet i denne filen: [https://github.com/github/gitignore/blob/master/VisualStudio.gitignore](https://github.com/github/gitignore/blob/master/VisualStudio.gitignore) 146 | 3. Lagre og commite `.gitignore`-filen. 147 | 148 | #### Hvordan commite `.gitignore` 149 | 150 | ##### Se Git-status 151 | 152 | For å vise status i Git, kjør følgende kommando: 153 | 154 | ```bash 155 | git status 156 | ``` 157 | 158 | ```bash 159 | On branch my-branch 160 | 161 | Untracked files: 162 | (use "git add ..." to include in what will be committed) 163 | .gitignore 164 | 165 | nothing added to commit but untracked files present (use "git add" to track) 166 | ``` 167 | 168 | Over ser vi at Git har oppdaget at `.gitignore` er en ny fil som Git ikke sporer. 169 | 170 | ##### Legg til .gitignore i Git 171 | 172 | For å legge til `.gitignore` i Git slik at Git kan spore ev. endringer i den filen i fremtiden, kjør følgende kommando: 173 | 174 | ```bash 175 | git add .gitignore 176 | ``` 177 | 178 | For å se status i Git igjen, kjør følgende kommando: 179 | 180 | ```bash 181 | git status 182 | ``` 183 | 184 | ```bash 185 | On branch my-branch 186 | Changes to be committed: 187 | (use "git restore --staged ..." to unstage) 188 | new file: .gitignore 189 | ``` 190 | 191 | #### Commite i Git 192 | 193 | For å lagre nåværende versjon av `.gitignore` i Git, kjør følgende kommando: 194 | 195 | ```bash 196 | git commit -m "La til .gitignore" 197 | ``` 198 | 199 | ```bash 200 | [my-branch 478fb9b] La til .gitignore 201 | 1 file changed, 1 insertion(+) 202 | create mode 100644 .gitignore 203 | ``` 204 | 205 | Nå er innholdet i `.gitignore` lagret i Git. Dersom du nå kjører `git status` på nytt, vil du se at det ikke er noen gjenstående endringer i repoet som Git ikke har fått med seg: 206 | 207 | ```bash 208 | git status 209 | ``` 210 | 211 | ```bash 212 | On branch my-branch 213 | nothing to commit, working tree clean 214 | ``` 215 | -------------------------------------------------------------------------------- /docs/en/setup-details.md: -------------------------------------------------------------------------------- 1 | # 📜 Details about setup on your computer 2 | 3 | This course assumes that you have some tools installed on your computer. Please review the list below to make sure you have what you need. 4 | 5 | > Installing and using Git is optional, but is nice to have if you want to have the guide, and [solution suggestions](https://github.com/nrkno/dotnetskolen/blob/main/README_EN.md#see-solution-suggestions), locally on your computer. 6 | 7 | ## 🛠️ Tools 8 | 9 | To complete the course you must have set up the following: 10 | 11 | - [.NET SDK](#NET-SDK) 12 | - [Configuring NuGet (Windows only)](#configuring-nuget-windows-only) 13 | - [An IDE](#IDE) 14 | - [Rider](https://www.jetbrains.com/rider/download) 15 | - [Visual Studio](https://visualstudio.microsoft.com/vs/community) 16 | - [Visual Studio Code](https://code.visualstudio.com/download) 17 | - [Git (optional)](#Git) 18 | 19 | ### .NET SDK 20 | 21 | When installing .NET you have the choice between installing 22 | 23 | - .NET runtime - runtime environment for .NET applications 24 | - .NET SDK - contains everything you need to develop and run .NET applications locally, and includes 25 | - .NET runtime and base libraries (BCL) 26 | - Compilers 27 | - .NET CLI - command line tool for building, running, and publishing .NET applications 28 | 29 | As you will be developing and running .NET applications throughout the course, you will need the .NET SDK installed on your computer. The course is written in .NET 9, but most of the commands will probably work with an older version of .NET Core, and will likely be available in future versions as well. You can check which version of .NET you have locally (if any) by running the following command 30 | 31 | ```bash 32 | dotnet --version 33 | ``` 34 | 35 | ```bash 36 | 9.0.102 37 | ``` 38 | 39 | If you do not have .NET installed on your computer, you can download it here: [https://dotnet.microsoft.com/download/dotnet](https://dotnet.microsoft.com/download/dotnet) 40 | 41 | As mentioned above, the .NET SDK also includes the .NET CLI, which gives us the ability to build, run, and publish .NET applications. After installing the .NET CLI, you can run `dotnet` commands in the terminal. In order for the course to work idenpenant of platform and IDE, we will use the .NET CLI to set up our solution. 42 | 43 | The tutorial explains the basics of the commands we will use in the .NET CLI. If you would like more detailed information or an overview of all the commands, you can read more about the .NET CLI here: [https://docs.microsoft.com/en-us/dotnet/core/tools/](https://docs.microsoft.com/en-us/dotnet/core/tools/) 44 | 45 | ### Configuring NuGet (Windows only) 46 | 47 | In .NET, you use "NuGet" packages to share code between projects. NuGet has a public repo of packages available at [https://www.nuget.org/](https://www.nuget.org/). If you haven't used NuGet on your Windows machine before, you may need to instruct NuGet to fetch packages from there. 48 | 49 | Open the file `C:/Users//AppData/Roaming/NuGet/NuGet.Config`, and paste the following content: 50 | 51 | ```xml 52 | 53 | 54 | 55 | 56 | 57 | 58 | ``` 59 | 60 | ### IDE 61 | 62 | To be able to debug code, get syntax highlighting and display of compilation errors, autocomplete, and code navigation, it is nice to have an IDE. The most commonly used IDEs for .NET are summarized in the table below. 63 | 64 | | Name | Platform | License | Download | 65 | | - | - | - | - | 66 | | Visual Studio|Windows | Community version is free. Other versions require a license. |[https://visualstudio.microsoft.com/vs/community](https://visualstudio.microsoft.com/vs/community)| 67 | | Visual Studio Code | Cross-platform | Free | [https://code.visualstudio.com/download](https://code.visualstudio.com/download) | 68 | | Rider | Cross-platform | Free for 30 days. After that, a license is required. | [https://www.jetbrains.com/rider/download](https://www.jetbrains.com/rider/download) | 69 | 70 | Choose the IDE that suits your needs. 71 | 72 | > If you are going to use Visual Studio Code, it is recommended to install the plugin "Ionide". 73 | > 74 | > - You can download Ionide here: [https://docs.microsoft.com/en-us/dotnet/fsharp/get-started/get-started-vscode](https://docs.microsoft.com/en-us/dotnet/fsharp/get-started/get-started-vscode) 75 | > - You can read more about Ionide here: [https://ionide.io/](https://ionide.io/) 76 | 77 | > Note that a common use case for IDEs is that they are also used to compile and run code. However, the instructions in the course will use the .NET CLI for this. You are of course free to build and run the code using your IDE if you wish. 78 | 79 | ### Git 80 | 81 | Git is a free version control system available for all platforms. If you want to have the instructions for the course (the document you are reading now), or see the expected result after completing each of the different steps, on your own computer, you need Git installed. With Git you can also create your own version of this repo as explained [here](#check-out-your-branch). 82 | 83 | You can download Git here: [https://git-scm.com/downloads](https://git-scm.com/downloads). 84 | 85 | If you are new to Git, it may be helpful to read this article on how to work with changes in a Git repo: [https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository). There are also instructions at the end of the first step](https://github.com/nrkno/dotnetskolen/blob/main/README_EN.md#save-changes-to-git-optional) on how to save changes you make during the course in Git. 86 | 87 | ## 💻 Local setup of the code (optional) 88 | 89 | ### Clone repo 90 | 91 | If you want this repo locally on your computer, you can fork this repo to your own user by following this guide: . Then you can clone it, like this: 92 | 93 | ```bash 94 | git clone git@github.com:/dotnetskolen.git # Download the repo from GitHub to your computer 95 | ``` 96 | 97 | ```bash 98 | Cloning into 'dotnet school'... 99 | remote: Enumerating objects: 9, done. 100 | remote: Counting objects: 100% (9/9), done. 101 | remote: Compressing objects: 100% (5/5), done. 102 | remote: Total 9 (delta 2), reused 4 (delta 1), pack-reused 0 103 | Receiving objects: 100% (9/9), done. 104 | Resolving participation: 100% (2/2), done. 105 | ``` 106 | 107 | > The command above assumes that you are using SSH to authenticate with GitHub. For more information about SSH authentication in GitHub, see 108 | > 109 | > If you want to clone with HTTPS instead, you must run the command above with this URL instead: `https://github.com//dotnetskolen.git`, and enter your username and password. 110 | > 111 | > You can also use [GitHub's desktop client](https://desktop.github.com/) 112 | 113 | You should now have the `main` branch checked out locally on your computer. You can verify this by going into the repo folder and listing the branches in Git: 114 | 115 | ```bash 116 | cd dotnetskolen # Go into the folder where the repo is located locally 117 | git branch # List all branches you have checked out locally 118 | ``` 119 | 120 | ```bash 121 | * main 122 | ``` 123 | 124 | ### Check out your own branch 125 | 126 | Before you start coding, you may want to create your own branch with `git checkout -b `. This way you can keep your changes separate from the code already in the repo, and it will be easier for the instructor to help you. 127 | 128 | ```bash 129 | git checkout -b my-branch 130 | ``` 131 | 132 | ```bash 133 | Switched to a new branch 'my-branch' 134 | ``` 135 | 136 | ### Setting up .gitignore 137 | 138 | There are usually some files that you don't want included in Git. This is something you quickly notice when setting up a new system. To tell Git which files you want to ignore, you can create a `.gitignore` file in the root of the repo. 139 | 140 | GitHub has its own repo that contains `.gitignore` files for different types of projects: [https://github.com/github/gitignore](https://github.com/github/gitignore). The `.gitignore` files that GitHub has prepared contain the file types that are most commonly excluded from Git for the different project types. Since this course is about .NET, we can use `VisualStudio.gitignore` from their repo. 141 | 142 | To set up `.gitignore` in your local repo: 143 | 144 | 1. Create a text file named `.gitignore` in the root of the repo 145 | 2. Paste the content of this file: [https://github.com/github/gitignore/blob/master/VisualStudio.gitignore](https://github.com/github/gitignore/blob/master/VisualStudio.gitignore) 146 | 3. Save and commit the `.gitignore` file. 147 | 148 | #### How to commit `.gitignore` 149 | 150 | ##### View Git status 151 | 152 | To view the status in Git, run the following command: 153 | 154 | ```bash 155 | git status 156 | ``` 157 | 158 | ```bash 159 | On branch my-branch 160 | 161 | Untracked files: 162 | (use "git add ..." to include in what will be committed) 163 | .gitignore 164 | 165 | nothing added to commit but untracked files present (use "git add" to track) 166 | ``` 167 | 168 | We see above that Git has detected `.gitignore` as a new file that Git is not tracking. 169 | 170 | ##### Add .gitignore to Git 171 | 172 | To add `.gitignore` to Git in order for Git to track any changes made in that file in the future, run the following command: 173 | 174 | ```bash 175 | git add .gitignore 176 | ``` 177 | 178 | To see the status in Git again, run the following command: 179 | 180 | ```bash 181 | git status 182 | ``` 183 | 184 | ```bash 185 | On branch my-branch 186 | Changes to be committed: 187 | (use "git restore --staged ..." to unstage) 188 | new file: .gitignore 189 | ``` 190 | 191 | #### Commit in Git 192 | 193 | To save the current version of `.gitignore` in Git, run the following command: 194 | 195 | ```bash 196 | git commit -m "Add .gitignore" 197 | ``` 198 | 199 | ```bash 200 | [my-branch 478fb9b] Added .gitignore 201 | 1 file changed, 1 insertion(+) 202 | create mode 100644 .gitignore 203 | ``` 204 | 205 | The content of `.gitignore` is now stored in Git. If you now run `git status` again, you will see no remaining changes in the repo that Git has not picked up: 206 | 207 | ```bash 208 | git status 209 | ``` 210 | 211 | ```bash 212 | On branch my-branch 213 | nothing to commit, working tree clean 214 | ``` 215 | -------------------------------------------------------------------------------- /docs/illustrasjoner/dotnet-arkitektur.drawio.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
10 |
11 | Maskinkode 12 |
13 |
14 |
15 |
16 | 17 | Maskinkode 18 | 19 |
20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
30 | Common language runtime 31 |
32 |
33 |
34 |
35 | 36 | Common language runtime 37 | 38 |
39 |
40 | 41 | 42 | 43 | 44 | 45 | 46 |
47 |
48 |
49 | Common intermediate language 50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | 61 | Common intermediate language... 62 | 63 |
64 |
65 | 66 | 67 | 68 | 69 | 70 | 71 |
72 |
73 |
74 | C#-kode 75 |
76 |
77 |
78 |
79 | 80 | C#-kode 81 | 82 |
83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 |
91 |
92 |
93 | F#-kode 94 |
95 |
96 |
97 |
98 | 99 | F#-kode 100 | 101 |
102 |
103 | 104 | 105 | 106 | 107 | 108 | 109 |
110 |
111 |
112 | C#-kompilator 113 |
114 |
115 |
116 |
117 | 118 | C#-kompilator 119 | 120 |
121 |
122 | 123 | 124 | 125 | 126 | 127 | 128 |
129 |
130 |
131 | F#-kompilator 132 |
133 |
134 |
135 |
136 | 137 | F#-kompilator 138 | 139 |
140 |
141 | 142 | 143 | 144 | 145 |
146 |
147 |
148 | Base class libraries 149 |
150 |
151 |
152 |
153 | 154 | Base class libraries 155 | 156 |
157 |
158 | 159 | 160 | 161 | 162 |
163 |
164 |
165 | C# executable 166 |
167 |
168 |
169 |
170 | 171 | C# executable 172 | 173 |
174 |
175 | 176 | 177 | 178 | 179 |
180 |
181 |
182 | F# executable 183 |
184 |
185 |
186 |
187 | 188 | F# executable 189 | 190 |
191 |
192 |
193 | 194 | 195 | 196 | 197 | Viewer does not support full SVG 1.1 198 | 199 | 200 | 201 |
--------------------------------------------------------------------------------