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:
git clone https://github.com/dotnet/aspnetcore.git
git checkout release/3.1
/global.json to know the correct SDKOpen 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.
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.)