简体   繁体   中英

Where is “Set as Startup” defined and persisted in C# winforms solutions?

我没有在.sln文件中看到它,这是我的预期。

Which project is the "startup" project only has any relevance for debugging, which means it's user metadata from the point of the solution and the projects. Regardless of which project is the "startup" project, the compiled code is the same.

Because of this, the information is stored as a user setting in the Solution User Options file (solution.suo) which accompanies the Solution file (solution.sln). The .suo file "Records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made" according to MSDN .

The .suo file is a binary file. If you want to read or change it programatically, you have to use IVsPersistSolutionOpts.LoadUserOptions from the Microsoft.VisualStudio.Shell.Interop namespace.

它位于解决方案用户选项 (.suo)文件中,该文件在.sln文件旁边创建。

It seems that the first item in the solution's sln file is, by default, the startup project. So, you could manually edit the sln file to make your project the first project in the solution. Then, a user can override that by selecting a different project to be startup.

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