I recently rearranged the content of my working folder which is used to store all my coding related projects. But after doing that I had problem loading solution of my WinForm project in Visual Studio Express 2012 as I received an error telling me about a problem with a project file.
Exact error message in the Output window was:
error : The project file could not be loaded. Could not find a part of the path…
Another way you can encounter this error is if you renamed your project folder and sometimes you can get this error without moving or renaming anything at all. In this article you will be shown how to solve this problem for all those cases.
For those who receive this error but did not move projects around
Try deleting .suo files in your solution folder. Solution User Option file is a binary file which contains various user information and settings such as location of the breakpoints.
If that didn’t help try also to delete .user file.
If you have trouble finding .suo file
In Visual Studio 2015 (also in Community Edition), the .suo file is located inside a hidden .vs folder in solution folder. Since both .vs folder and .suo file have hidden attribute applied to them, you have to reveal them using using File Explorer by changing folder options to “show hidden files, folders and drives”.
How to get to this option in File Explorer depends on the version of Windows:
- In Windows 7, option is located under Organize > Folder and search options.
- in Windows 8, it is located under View tab > Options > Change folder and search options.
- in Windows 10, it is the same as in Windows 8.
For those who have this error due to moving projects around or renaming the project
The problem lies with the nonexistent path of one or more projects that are stored into the solution file.
You can solve this problem in two ways:
Using Text Editor
One way to fix this error is to correct path of the problematic projects yourself by directly editing .sln file.
For those who feel uncomfortable editing the solution file there is another way. You can fix the path of the project directly from Visual Studio and this procedure is shown next.
Using Visual Studio
Just follow these steps:
- Load the solution into VS. You might get Error Popup Window with the message shown below. Ignore the warning and click OK.
Error window with a message “One or more projects in the solution were not loaded correctly. Please see the Output Window for Details.”
- In the Solution Explorer you should find at least one project that was not loaded. Select that project. It will have (unavailable) text next to the name as shown below:
Solution Explorer with unavailable project
In Properties Window you will find unloaded project properties. There will be a single property named File path which stores the path of the project. We need to change that so click on the path. Browse button … will appear on the right as shown in the following image. Click on it.
Properties Window of the unavailable project showing the project’s path.
Note:Sometimes, the path in File path property is grayed out and you are unable to get to the Browse button. In this case try deleting .suo files. Don’t worry, these files gets recreated when you rebuild the solution / project.
- File Dialog box will open. Locate project file (.csproj) and click Open.
- In the Solution Explorer, the project will still have (unavailable) message besides it. We still need to carry out one more step. Right-click on the project to open context menu. Select Reload Project as shown below:
Reloading the unloaded project in the solution explorer.
- Build solution. If you get an error telling you that the referenced project does not exist, we need to update references. Save solution and Close it, then Open project again.
Now you should be able to build solution without getting errors (at least not those relating to paths of a project file).
If you found this article useful, drop a comment or follow me on the social networks.