If you are facing error in NET 8 and all dependencies packages are compatible and your visual studio 2022 Version 17.12.2 then You need to update visual studio because in previous version have some major bugs. I updated and issue will be solved. See more details on microsoft's official page