According to the docs, VS v17.1 does not support .net 8.
To target net8.0, you must use version 17.8 or later.
https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/version-requirements