How to run the ASP.NET Core 3.1 samples

September 15 · 2 mins read

I was trying to run the Cookie authentication sample from ASP.NET Core 3.1 code repository. I encountered some errors. These steps mights save you from those errors:

Step 0: Clone the repository

git clone https://github.com/dotnet/aspnetcore.git

Step 1: Select the correct branch

git checkout release/3.1

Step 2: Open /global.json to know the correct SDK

Open the file /global.json in a text editor. It contains the SDK version being used in the project.

{
  "sdk": {
    "version": "3.1.107"
  }
  ...

Open a command window and check the .NET SDK versions already installed in your machine by executing this command:

dotnet --list-sdks
1.0.0-preview2-003121 [C:\Program Files\dotnet\sdk]
...
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
3.1.401 [C:\Program Files\dotnet\sdk]
3.1.402 [C:\Program Files\dotnet\sdk]

If the version from your /global.json, version 3.1.107, is not listed, go to .NET Core 3.1 SDK downloads site then search for version 3.1.107, then download the installer for the SDK.

Step 3: Restore dependencies then run

Go to folder \aspnetcore\src\Security\samples\Cookies from the command line then

dotnet restore

then

dotnet run

(NOTE: I was unsuccessful when I tried to run it in Visual Studio 2019. I will just update this post later when I already figured out how.)


Buy Me A Coffee