In my case, the tool I wanted to run did not only require the dotnet runtime but also the ASP.NET Core Runtime, so I had to install two packages.
Probably swagger also requires the asp net runtime.
Links to dotnet 8 download overview page https://dotnet.microsoft.com/en-us/download/dotnet/8.0
Or with chocolatey package manager for dotnet 8:
choco install dotnet-8.0-runtime
choco install dotnet-8.0-aspnetruntime