Hello @Anonymous ,
Welcome to Microsoft Q&A forum.
Please first try to create a new ASP .NET Core web application(MVC) again and check if the same error appears this time.
If the same error appears, please try to reset VS(run devenv /ResetSettings
in Developer Command Prompt for S 2022) and repair VS(VS Installer > More > Repair).
If no error appears, please go back to your project, right-click the project > Unload Project > right-click it again > Edit Project File. In the .csproj file, make sure that there’s no assembly binding redirects(try to remove it if it exists). Remove the hidden .vs folder in your solution folder and rebuild your project.
Besides, from the error message looks like the error may be caused by different versions of .NET/targeted framework.
Can you confirm that your machine has .net 6 and .net 7 installed(run dotnet --list-sdks
in CMD), and in VS Installer > Modify > Individual components > .NET 6.0 Runtime and .NET 7.0 Runtime have been checked?
Feel free to let us know the results.
Sincerely,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.