visual-studio Visual Studio:它在哪里存储“设置为启动项目”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1876059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:18:02  来源:igfitidea点击:

Visual Studio: Where does it store "Set as startup project"?

visual-studiovisual-studio-2008

提问by sivabudh

Let's say a single solution (.sln) has 2 (.vcproj) named Proj1 and Proj2. By default, Visual Studio assigned Proj1 to be my startup project.

假设单个解决方案 (.sln) 有 2 个 (.vcproj),名为 Proj1 和 Proj2。默认情况下,Visual Studio 将 Proj1 指定为我的启动项目。

I set Proj2 to be my desired startup project.

我将 Proj2 设置为我想要的启动项目。

Then I commit everything to my repository (excluding .suo).

然后我将所有内容提交到我的存储库(不包括 .suo)。

I re-check out, and Proj1 is still the default startup project.

我重新检查了一下,Proj1还是默认的启动项目。

Does this mean Visual Studio store the startup information in the .suo file? But I dont want to commit that (?) since it's a user-specific file?

这是否意味着 Visual Studio 将启动信息存储在 .suo 文件中?但我不想提交(?),因为它是用户特定的文件?

Or am I doing something wrong?

还是我做错了什么?

Note: I use Visual Studio 2008

注意:我使用 Visual Studio 2008

采纳答案by Andy West

Yes, it is stored in the .suo file.

是的,它存储在 .suo 文件中。

Here's a similar post explaining why.

这是一个类似的帖子,解释了原因

回答by Matt Davis

As @Gishuand @misteraidanboth said, Visual Studio uses the first project listed in the .sln file as the default startup project. If you have a primary project that should alwaysbe the default, just modify the solution in a text editor to list that project first in the list.

正如@Gishu@misteraidan所说,Visual Studio 使用 .sln 文件中列出的第一个项目作为默认启动项目。如果您有一个应始终为默认值的主要项目,只需在文本编辑器中修改解决方案,以在列表中首先列出该项目。

EDIT

编辑

Yes, it still works in Visual Studio 2019. By default, Visual Studio uses the first project listed in the solution file (.sln) as the default startup project. However, if you manually change the startup project inside Visual Studio, that setting appears to be stored in the .suo file located in the hidden .vs folder, and it overrides the sorted order in the .sln file.

是的,它在 Visual Studio 2019 中仍然有效。默认情况下,Visual Studio 使用解决方案文件 (.sln) 中列出的第一个项目作为默认启动项目。但是,如果您在 Visual Studio 中手动更改启动项目,该设置似乎存储在位于隐藏 .vs 文件夹中的 .suo 文件中,并且它会覆盖 .sln 文件中的排序顺序。

However, if you close Visual Studio, delete the .vs folder, and then re-open the solution, whatever project is listed first in the .sln file regardless of project typewill be used as the default startup project.

但是,如果您关闭 Visual Studio,删除 .vs 文件夹,然后重新打开解决方案,无论项目类型如何,首先在 .sln 文件中列出的任何项目都将用作默认启动项目。

回答by womp

Yes, it gets stored in the .SUO.

是的,它存储在 .SUO 中。

Although this can be an issue if you're often checking out branches or deleting your trunk workspace and checking it out again, it only takes a second to set it, so hopefully it's not too big an issue. You should definitely keep the .suo files out of the repository if you can.

虽然如果您经常检查分支或删除主干工作区并再次检查它,这可能是一个问题,但设置它只需要一秒钟,所以希望这不是一个太大的问题。如果可以,您绝对应该将 .suo 文件保留在存储库之外。

回答by Dr. Xray

Yes, it is .suo file, and yes it is a user-specific file: it is really what do you like to do for your current project debug. I think it is possible for different developer in the team who want to have different settings on this.

是的,它是 .suo 文件,是的,它是一个特定于用户的文件:这确实是您为当前项目调试所做的工作。我认为团队中的不同开发人员可能希望对此有不同的设置。

回答by Daniel Clarke

The .SUO file may be hidden by default, to see it you may need to turn on "view hidden files" in Windows Explorer.

.SUO 文件可能默认是隐藏的,要查看它,您可能需要在 Windows 资源管理器中打开“查看隐藏文件”。