This is the perfect solution and in my console .Net 8 application this worked fine. After changing the configuration Error 1
Got the above error and had to fix it as well in program.cs. Fix 1