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 a problem loading the solution of my WinForm project in Visual Studio as I received an error telling me about a problem with a project file.
The exact error message in the Output window was:
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, 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 in the solution file.
You can solve this problem in two ways:
Using Text Editor
One way to fix this error is to correct the path of the problematic projects yourself by directly editing the .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.
- 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:
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.
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:
- 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 a solution without getting errors (at least not those relating to paths of a project file).
Manal Adham
May 22, 2013Excellent! Solved!
Razwan
July 3, 2013please answer me how can i fix my visual basic error 2012 this text it came(((Error 1 Task failed because "resgen.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "resgen.exe" in the "bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx35Tools-x86. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK. 2) Install Visual Studio 2010. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the "ToolPath" parameter of the task. WindowsApplication15
))
admin
July 3, 2013I never encountered this error, but the error message is straightforward. Path stored in the registry key mentioned above does not contain resgen.exe.
In my machine that registry key has InstallationFolder string with the following value:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\
and resgen.exe can be found in two places:
If resgen.exe is missing on your machine, maybe all you need is to get that file.
You could get it by installing Visual Studio (as mentioned in your error message) or if you wish, I could just give you the necessary resgen.exe.
Pooran Yadav
September 9, 2016I did everything according to your instructions.....but i still getting error....."resgen is not recognized as internal and external command"
admin
September 9, 2016Open
.csproj
in text editor, search for resgen and try replacing it with the full path to the resgen.exe.Jordan Villalobos
July 29, 2013Thank you, I was pulling my hair trying to get my project to load properly, since I will be moving my project from one computer to another.
bharat
April 14, 2016Nice. Thank you.
Joseph
September 5, 2013This was very helpful thank you so much. However this continues to happen to me after I compress a file containing the .sln. I need to compress them for school. Is there a possible way to keep this from happening every time?
devi
September 7, 2013i was tried your solution. but in my property window file path is in no editable mode.
then how can i resolve this problem??
admin
September 7, 2013Try deleting .suo file first. Another way is to edit .sln file in a some Text Editor and fix the paths there.
sherlockspreadsheets
December 5, 2017Thank you so much. After deleting .suo file, I was able to edit the filepath and reload the solution.
j
October 3, 2013perfect! Thanks!
Abdoulaye
December 23, 2013hello ,
I have the same probleme but like 'DEVI' but in my property window file path is in no editable mode and i cannot found the .suo file ????
i am using visual studio 2010 (premium)
Osas
January 22, 2014Perfect
Fabio
March 18, 2014For me it's doesn't work. I had copy files of solution to another folder. (Without .suo and .vssscc)
In my case this problem happened after to add solution to TFS.
Jo
September 2, 2014We just had the same issue after removing a solution where we are also using TFS.
The issue was that the number of projects went out of line with the actual project in the solution.
e.g. GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 17
and ..
SccProjectName15 =
After changing SccNumberOfProjects to 16 to match the projects this resolved our issue.
Dennis van der Pool
September 9, 2015Hi,
I'm using Visual Studio 2015 Enterprise and had the same issue. Your solution solution solved our problem, thanks for sharing.
Greets,
Dennis van der Pool
Timple Nithiya
May 13, 2014Excellent. I got the solution within few secs. Thanks
Sean Harrison
August 7, 2014Everything worked for me up until the attempted rebuild -- all of the build options are still greyed out.
vahid
August 29, 2014how to fix this error
Error 2 Unable to resolve type 'Klik.Windows.Forms.v1.Common.KFormManager, Klik.Windows.Forms.EntryLib.V2.2008, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' D:\Project\Abbas ghazvine\Abbas ghazvine\Properties\licenses.licx 1 Abbas ghazvine
admin
August 29, 2014I'm not familiar with this type of error but maybe this question in Stackoverflow might help you:
http://stackoverflow.com/questions/13652531/debugging-error-licenses-licx-unable-to-resolve-type
Russell
September 25, 2014If you are working with a web project and get this error it could be do to IIS permissions.
I get around it by running visual studio as administator and that give you permission to access IIS and the project will load then.
Steve
September 26, 2014The last part of deleting the file path and reopening the project worked for me. Thanks!!
Great
October 2, 2014Thank you!!
Hrishikesh
December 23, 2014If you have this types of error then first do reload the project in solution Explore then you get error message. There give message as "Not find targeted file" then this file can copy at require location and restart VS.
Noam
January 7, 2015Great stuff - thanks
Dilli Rajan
January 12, 2015Excellent solution! It worked fine for me. Thanks.
Balazs
January 23, 2015Thank you!
This post is a life saver. I could not load my project after reinstalling Windows and Visual Studio. I did not touch the project files, they remained at the same location on a second partition, still the project would not load. I tried literally everything, searched for solutions everywhere to no avail.
Now the project loads without a problem, I just had to delete the .suo files.
Thanks again!
Balazs
Kenny
March 24, 2015Thanks a bunch! It worked. Finally found a solution to this....Have bin experiencing these for sometimes now.
Patrick
May 12, 2015deleting the .suo files ungrayed the path field
RiJo
May 18, 2015Thanks a lot, you saved my day.:)
Lehlohonolo Letaoana
June 28, 2015It worked! 😀 Thanks a lot mate!
Albert
January 24, 2016Thanks a lot! This resolved my problem!
Andre
February 17, 2016Saved my life
Harpal
February 18, 2016please suggest...Where to locate .suo files. i am using VS 2015..thnx
admin
February 18, 2016In VS 2015 it is located in
.vs
folder. Both.vs
folder and.suo
file have hidden attributes applied to them, so you need to change folder options to "show hidden files, folders and drives" to reveal them.Harpal
February 19, 2016Thnks alot...worked for me
genevieve
February 24, 2016Where to locate .suo files. i am using VS 2012
admin
February 24, 2016In VS 2012, check if it is in the same location as in VS 2015, which is in
.vs
hidden folder.MJH
March 23, 2016My directories were not located in the *.SLN file they were located in the *.vbproj file; this file was located one directory further down with all of the other project files (Mine had the same name as my project). Edited the text file, simply removing the path and leaving just the file names it worked.
Hope this helps if you could not locate directories in the *.SLN file
LLS
June 13, 2016Ah, at last, fixed my problem with your help. Thank you.
Swathi
June 15, 2016Thanks.Great solution
Black Cock
January 27, 2021Thanks to you
Anatoliy
July 4, 2016Thanks. Great solution.
DW
August 11, 2016Beautiful
Fagrie
August 19, 2016Nice. Thank you.
Michael Strebl
August 31, 2016You are my hero 🙂 Thanks so much .. i spent hours and hours to get the damned thing back. Just the deletion of the suo file helped :-))))))))))
Maurizio
September 13, 2016I'm using an old version of VS 2003 on Windows XP. I deleted the
.suo
file but the reference is still disabled.How can I solve please? thx
Alex
September 19, 2016Excellent! Excellent! Excellent!
Gerry
September 30, 2016Deleting the suo file worked for me too (trying to open a VS 2010 solution in VS 2015) many thanks for taking the time to post this excellent advice it's very much appreciated.
Trent
November 17, 2016Where exactly would I find the .user file, I'm using VS 2015,
admin
November 17, 2016It should be located inside the project folder, but it seems, the
.user
file is only created in Web projects.DAwilly
December 21, 2016Perfect. This resolved the problem
sanjay
January 5, 2017Awesome, you saved hours of googling !
Mahdi
March 3, 2017Excellent! Thank you
Kolade Ige
March 4, 2017Thanks alot. Deleting all .user files in my solution worked for me.
TheOne
March 6, 2017Thanks a lot dude.
mike
March 20, 2017Hello Dear.
I just moved my project and then I did what you told but still not working and giving me this messages:
1:Unable to read the project file '*.csproj'
2:C:\Users\....\*.csproj.user: The project file could not be loaded. Root element is missing.
I deleted .user file, it start working, but it does not get any changes.
admin
March 20, 2017Hi,
It seems the .csproj file which is in XML format doesn’t have the correct XML structure. Maybe the file got corrupted. Try examine the file with a text editor.
Erin
May 5, 2017Thank you!!
marmar
May 25, 2017Thank you so much!
Milos Petrovic
May 25, 2017Thanks. It's working 😀
kenhero
June 16, 2017Thank you so much.
Christ
August 1, 2017Thank U SOOO much.
Semira
August 1, 2017Thank you so much . I found it very helpful.
Asia
October 7, 2017Thanks so much 🙂
Kukuruyuk
October 12, 2017How can i solve this error ? error: Illegal filename 'Problem.vcxproj.filters'. I use visual studio c++ 2010
Supriya
October 25, 2017Hi I am doing project in visual studio 2012 it was working but now I have done bit changes in the form which was already I have created ..but now when m ruining the project it's not giving result whatever I changed..only giving the previous output..pls help me
Megan
October 30, 2017You are wonderful! It worked for me. Thank you so much.
Bryon
November 13, 2017I guess this is too old to work anymore. Having this issue with solutions checked into TFS.
O Nikhilesh
January 4, 2018Thank you so much it solved the error
Oren
January 15, 2018Thank you!!
You really saved me!
Mahmoud
January 26, 2018Thanks !
I can reload my sol right now but i faced the following error
Error 1 Application Configuration file "app.config" is invalid. Could not find file 'D:\Samsung data\Desktop\pal\project t1-3TABLE - bedaaaa - D2 - final\project t1\app.config'. D:\Samsung data\Desktop\pal\project t1-3TABLE - bedaaaa - D2 - final\project t1\app.config project t1 (2016_03_15 08_25_53 UTC)
admin
January 27, 2018It seems you need to fix the paths that are stored inside the app.config file.
nishu
February 5, 2018my visual studio 2010 professional setup was sucessfully installed in my system . when i opened the software and tried to create a new project it gave me a popup box saying... The type initilizer for 'microsoft.visualstudio.build.cominteropWrapper.projectShim' threw an exception. when wevr i try to open an existing project it says ' one or more projects were not loaded' . i tried installing many different setups of vs2010 bt it gave me the same exception. please help me its really verry imp for the software to work.
Ritu Goel
February 25, 2018So nicely explained. The learning is so much easier this way.
paridhi
March 4, 2018I'm trying to create a C++ file in Visual Studio Express 2012, and I'm running into an error I haven't encountered in the past. Below you'll see exactly what I'm doing, and it always works but is now, for some reason, not.
New Project -> creates new project -> Win32 Application Wizard -> Application Settings -> clicks on Empty project checkbox -> Clicks Finish button -> ERROR
The error reads "System.Collections.Generic.RandomizedStringEqualityComparer is not a GenericTypeDefiniton. MakeGenericType may only be called on a type for which Type.IsGenericTypeDefinition is true."
I literally have no idea why something like this is happening
admin
March 7, 2018I had a similar issue a while ago when creating a project gave me some strange errors and only solution I found was to reinstall VS.
You could also try this Stackoverflow solution for the "System.Collection.Generic.RandomizedStringEqualityComparer is not a GenericTypeDefinition." error.
Vijay
March 29, 2018Superb,Solve the issue !!!
Eben
July 6, 2018Hi, using VS 2017,
The filepath under properties for the unavailable project does point to a .csproj file,
But when I navigate to the actual project folder in the file manger, I see that there are only 4 directories there, no .csproj file. The directories are: bin, Entities, Migrations and obj.
The .Data dir's parent dir contains also the web project dir, and an obj dir which contain's 'projectName'.Data.csproj.EntityFrameworkCore'. I don't know if that has anything to do with it.
Corey
July 13, 2018This proved to be a difficult thing to search for. The SUO files were my problem. Deleting them allowed me to edit the paths to the projects that had been moved, I've been wondering for years why sometimes I could edit the project paths in Visual Studio but sometimes they are grayed out. Yours was the only solution I was able to find on the internet. Thank you for posting.
Murali
July 17, 2018Fantastic,, it worked ! thanks..
Carlos
August 16, 2018It helped me a lot! Thanks.
ihsan
January 6, 2019Hello sir, whenever i added lesson to the lesson copier in tell me more software cannot access the lesson
and the software is not opening, give me the message ( the user option file could not be found)
plz reply
Pratibha Sampath
May 21, 2020Great. This helped a lot. Thank you.
NS
September 10, 2020Thanks. This helped.
Biswajit
May 25, 2021could not find a part of the path
'c :\users\LENOVO\ documents\visual studio 2015 websites \,\ userphoto\'
.Any solution ??
admin
May 25, 2021From your path, I can see it's a web application. Maybe you are missing the tilde character ~ when referring to the URL path in your code. This will make sure the URL points to the web application root folder.
Marcelo
September 13, 2021This solution still working. Thanks.
Noga
September 30, 2021thank you, that helped a lot!
Anurag Deshmukh
October 27, 2021Worked for me! Thanks!
alperen
September 6, 2023Awesame solution. Works for me