This is the common issue in Visual Studio Platform when you migrate your project from one system to another or sometime you may face this issue even on changing the location of the project into the same system.
1. First - Minor Fix:
Sometimes this minor fix works fine to soleve the issue, I will recommend you to go through the following steps and check if it solves your problem or not if it fails for you, It is recommended to get for the Second fix.
Steps to fix issue 👇
- Close the project and Visual Studio as well.
- Navigate to the project location.
- Find the
.vsfolder (This is a hidden folder so make the Show Hidden files feature enable)
- Delete this .vs folder.
- Again open the Visual Studio and run the project the error should be fixed. Still Same Error I think you need the second fix. Try that one.
2. Second - Major Fix:
Usually First fix works for most of the people but not everyone is lucky enough, Like I was not when I was moving my project from the old Laptop Visual Studio 2013 to New Laptop Visual Studio 2022 so this second fix works for me.
This fix is a little bit tricky and need small code modification follow the steps below best of luck
- Open the Visual Studio by right clicking on it and selecting
Run as administratoroption.
- Open your project from the Recent Projects option.
- The project should be in solution explorer right click on the project and click on unload the project option.
- Again click on the project and select the option
- Find the code as shown below and Delete it.
<DevelopmentServerPort>54367</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost:54367/</IISUrl>
Note: Don't worry about the number
54367 in above code it could be different in your case simply delete it.
- Save and close the file after Deleting it.
- In Solution Explorer again right click on your project name from where you unload the project and reload it. I hope your issue is ressolved now, Run the project and check it.
Don't forget to tell me in comment - Which method works for you.