visual-studio 我可以将 Visual Studio 配置为每次从其中一个项目打开文件时不更改启动项目吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4434/
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
Can I configure Visual Studio NOT to change StartUp Project every time I open a file from one of the projects?
提问by Marek Grzenkowicz
Let's say that there is a solution that contains two projects (Project1 and Project2).
假设有一个包含两个项目(Project1 和 Project2)的解决方案。
Project1 is set as a StartUp Project (its name is displayed in a bold font). I double-click some file in Project2 to open it. The file opens, but something else happens too - Project2 gets set as a StartUp Project.
Project1 设置为启动项目(其名称以粗体显示)。我双击 Project2 中的某个文件将其打开。文件打开,但也发生了其他事情 - Project2 被设置为启动项目。
I tried to find an option in configuration to change it, but I found none.
我试图在配置中找到一个选项来改变它,但我没有找到。
Can this feature (though it's more like a bug to me) be disabled?
这个功能(虽然对我来说更像是一个错误)可以被禁用吗?
采纳答案by Lea Cohen
The way to select a startup project is described in Sara Ford's blog "Visual Studio Tip of the Day" (highly recommended). She has a post there about setting up StartUp projects. Essentially there are 2 ways, the easiest one being right-clicking on the desired project, and choosing "Set As StartUp Project". That prevents other projects from becoming the StartUp project, even if you click on one their files.
选择启动项目的方法在Sara Ford 的博客“Visual Studio Tip of the Day”中有描述(强烈推荐)。她有一篇关于设置 StartUp 项目的帖子。基本上有两种方法,最简单的一种方法是右键单击所需的项目,然后选择“设置为启动项目”。这可以防止其他项目成为 StartUp 项目,即使您单击它们的文件也是如此。
回答by kokos
Check your Visual Studio options for the following check box:
Projects and Solutions - Build and Run - For new solutions use the currently selected project as the startup project.
选中以下复选框的 Visual Studio 选项:
项目和解决方案 - 构建和运行 - 对于新解决方案,使用当前选定的项目作为启动项目。
Uncheck that and see if the behavior changes.
取消选中并查看行为是否发生变化。
回答by ShawnFeatherly
I ran into a bug where the project in bold would not be the startup project despite it being selected in the solution properties as the "single startup project".
我遇到了一个错误,尽管粗体项目在解决方案属性中被选为“单个启动项目”,但它不会是启动项目。
One work around for this bug was un-checking deploy, from the Configuration Manager, for the non-bold project that was being incorrectly used as the startup project. The configuration manager is found by right clicking the solution in the Solution Explorer.
解决此错误的一种方法是从配置管理器中取消检查部署,用于被错误地用作启动项目的非粗体项目。通过右键单击解决方案资源管理器中的解决方案可以找到配置管理器。

