简体   繁体   English

每次从其中一个项目打开文件时,是否可以将Visual Studio配置为不更改StartUp Project?

[英]Can I configure Visual Studio NOT to change StartUp Project every time I open a file from one of the projects?

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). Project1设置为StartUp Project(其名称以粗体显示)。 I double-click some file in Project2 to open it. 我双击Project2中的某个文件将其打开。 The file opens, but something else happens too - Project2 gets set as a StartUp Project. 该文件打开,但也发生了其他事情 - Project2被设置为StartUp项目。

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? 可以禁用此功能(虽然它更像是我的错误)吗?

The way to select a startup project is described in Sara Ford's blog "Visual Studio Tip of the Day " (highly recommended). Sara Ford的博客“Visual Studio每日提示 ”(强烈推荐)中介绍了选择启动项目的方法。 She has a post there about setting up StartUp projects . 她有一篇关于设置StartUp项目的帖子。 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. 这可以防止其他项目成为StartUp项目,即使您单击其中一个文件也是如此。

Check your Visual Studio options for the following check box: 检查Visual Studio选项以获取以下复选框:
Projects and Solutions - Build and Run - For new solutions use the currently selected project as the startup project. 项目和解决方案 - 构建和运行 - 对于新解决方案,使用当前选定的项目作为启动项目。

Uncheck that and see if the behavior changes. 取消选中该项,然后查看行为是否发生变化。

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. 通过右键单击解决方案资源管理器中的解决方案找到配置管理器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 每次运行时都会构建项目 - Visual Studio Builds Projects Every Time I Run 每次构建源项目时,如何跳过构建所有引用的项目 - How can I skip building all referenced projects every time when I build my source project 我可以在Visual Studio 2015中打开旧的Visual Studio解决方案(2005,2008,2010,2013)而无需升级项目吗? - Can I open old Visual Studio Solutions (2005,2008, 2010,2013) in Visual Studio 2015 without upgrading the projects? Visual Studio C# 我可以使用哪个 Class 库项目引用 Blazor 项目 - Visual Studio C# with which Class Library Projects can I reference a Blazor Project 如何在多个Visual Studio项目中实现每个项目的appSettings和全局appSettings? - How can I implement per-project appSettings and global appSettings across multiple Visual Studio projects? 如何防止Visual Studio每次生成项目? - How to prevent Visual Studio from building the project every time? 在Visual Studio中编程.NET,如何从项目引用中分辨文件引用? - In Visual Studio, programming .NET, how can I tell a file reference from a project reference? 如何更改许多Visual Studio项目的references文件夹? - How do I change the references folder of a lot of Visual Studio projects? 如何从 Visual Studio 中的另一个解决方案调试项目? - How can I debug a project from another solution in Visual Studio? 为什么我无法在 Visual Studio 中合并项目 sdk 版本? - Why I can't consolidate projects sdk versions in Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM