I just got this error while publishing my first ASP.NET Core application in Self Contained Deployment mode.
One-liner solution to this problem is - Just repair your Visual Studio.
Though I took some screenshots of repairing steps, I thought attaching those screenshots here might help you.
- Step 1: Search for Visual Studio Installer:
- Step 2: Select repair option
- Step 3: Click on OK
- Step 4: At the end, restart the system.
After re-starting the system, you will find that issue has been fixed. :)