Visual Studio: How to arrange the projects inside solution explorer by dependency

眉间皱痕 提交于 2019-12-18 16:48:40

问题


Is there any way to manually arrange the projects inside solution explorer of VS 2010+ based on the dependency (dependent project on higher level) ?


回答1:


No, but when I have a solution with a lot of projects that I want to convey this build flow, I do something that may suit your needs.

Because the Solution Explorer sorts things alphabetically, I put projects into "Solution Folders". I put a prefix on each project folder. So, I might name a folder "A. Helper Assemblies". So, my solution looks like this:

Solution
   A. Helper Assemblies
      Project1.vsproj
      Project2.vsproj
   B. Core Assemblies
      ProjectX.vsproj
      ProjectY.vsproj
   C. UI Assemblies
      ProjectMoe.vsproj
      ProjectLarry.vsproj
      ProjectShemp.vsproj

This doesn't change any project dependencies, though. It's simply a manual effort to ensure that the project build order matches the folder structure.

For exact details on adding a Solution Folder, go here: http://msdn.microsoft.com/en-us/library/c6c756s6(v=vs.100).aspx




回答2:


On top of using solution folders and solution folder prefixes, you can use prefixes on project folders too.

The trick is to add the project with a normal name, then rename it "select it and press f2" in solution explorer.

By renaming it after you've added it, you keep your assembly name/namespace the way it should be. Also renaming it after means your project folder name doesn't change with the prefix. So the below example, on disk, would be Thing.Core not 10_Thing.Core

  • 05_Thing.Database
  • 10_Thing.Core
  • 15_Thing.Api
  • 20_Thing.Api.Services
  • 25_Thing.Data
  • 30_Thing.Host
  • 90_Thing.Test


来源:https://stackoverflow.com/questions/15715221/visual-studio-how-to-arrange-the-projects-inside-solution-explorer-by-dependenc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!