'The value "" of the "Project" attribute in element <Import> is invalid. - Visual Studio

I am currently facing an issue when trying to work on a solution in Visual Studio 2022.

I was able to work just fine on the solution and code on it before. But today, all of a sudden, when I tried opening it again, I get the error: "The value "" of the "Project" attribute in element is invalid." on ALL of the projects under my solution (there are about 30 projects).

I have done everything I found online but none of the proposed solutions worked for me.

  1. I tried to "Clean" the solution and rebuild it. It did not work

  2. I closed and reopened Visual Studio. It did not work.

  3. I tried reloading the projects. That did not work.

  4. I tried restoring the NugetPackages. That did not work.

  5. I tried the following command: dotnet restore MySolution.sln. It did not work either. This method failed and it kept giving me this error for all 30 projects in my solution:

    "warning NU1503: Skipping restore for project 'D:\myRepo\Project1.csproj'. The project file may be invalid or missing targets required for restore."

Any ideas or tips on what can I do now?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source