简体   繁体   中英

Visual Studio not saving startup project and solution config

I've got a C++ solution that always forgets the solution config(debug vs release etc), and startup project when opened.

On startup it always defaults back to debug, and no startup project.

This data used to save correctly, but a few months ago it ceased to function. Originally this was with VS2013, but I'm on VS2015, and the solution continues to not save this data.

I've tried deleting various files.

In the solution folder I deleted the.sdf
In the solution Release folder there was a.suo I deleted

Neither of these fixed the problem.

I don't know where this information is saved, does anyone know how to go about fixing this problem?

Thanks

This information is stored in a .suo file. In VS 2015 this file is stored in a hidden .vs directory along the solution file (.vs\\solution_name\\v14\\.suo). You can try to delete this file in case it is corrupted.

The selected answer did not work for me, the file got recreated but after that again when running the solution it switched to a wrong startup project. I ended up fetching the complete solution again from our GIT repository, which did fix the issue.

For Visual Studio 2019, my solution would always reset the Startup Project whenever I wiped out the hidden.vs folder (for archiving purposes).

I fixed this by opening the solution file (.sln) in a text editor and reordered the listed projects at the top. The first one in the list appears to be the default Startup Project for the solution.

Example:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31702.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TankGL", "TankGL\TankGL.vcxproj", "{0AF68ACE-D3AC-401F-8F09-7F62D7AB0129}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gcore", "gcore\gcore.vcxproj", "{7334E503-CCCB-4B67-B949-AD0E0005A4AB}"
EndProject

...

Here "TankGL.vcxproj" is the default project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM