如何在解决方案根目录下添加"src"文件夹 [英] How to add 'src' folder at solution root

查看:580
本文介绍了如何在解决方案根目录下添加"src"文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这听起来像是一个愚蠢的问题,但是Visual Studio似乎不允许我做这种简单的组织,我一直在github上看到它.

This is going to sound like a silly question, but Visual Studio does not seem to let me do this simple organization which I see all the time on github.

我从新的空解决方案开始.

I start with new empty solution.

然后,我想添加一个"src"文件夹,其中将包含项目多个项目.如果我右键单击并选择添加文件夹",则VS将添加虚拟文件夹,而不是实际文件夹.

I then want to add a "src" folder which will contain project multiple projects. If I right click and select "Add Folder" VS adds a virtual folder, not an actual folder.

如果我使用Windows资源管理器在所需位置创建一个新文件夹,VS将忽略它,并且不会让我添加到解决方案"

If I use Windows Explorer to create a new folder in the desired location, VS ignores it and does not let me "Add to solution"

如果添加项目,它将在根目录而不是所需文件夹中添加该项目.

If I add a project, it adds the project at the root, not in the desired folder.

那么,如何添加此文件夹?

So, how do I add this folder?

推荐答案

我设法做到了,尽管这有点骗".

I managed to do this, although it is a bit of a "cheat".

  1. 创建名为"src"的解决方案文件夹

  1. Create Solution Folder called "src"

在文件资源管理器中,还要在解决方案文件夹中创建一个名为"src"的文件夹

In file explorer also create folder called "src" inside your solution folder

现在,当您将新项目添加到解决方案中时,将其添加到"solution_folder \ src"中,因为磁盘上现在存在"src".此时,在解决方案视图中,该项目实际上将显示在"src"文件夹之外.

Now when you add new project to the solution, add it to the "solution_folder\src" because "src" now exists on the disk. At this point, in the solution view, this project will be actually shown outside of the "src" folder.

只需将该项目拖到解决方案结构中的"src"文件夹中,即可将其放在解决方案视图中的"src"文件夹下以及磁盘上实际的"src"文件夹中.

Simply drag that project to the "src" folder in your solution structure and you will have it under "src" folder in you solution view and in the actual "src" folder on the disk.

请注意,解决方案视图中的"src"文件夹与磁盘上的"src"文件夹不同,一个是解决方案文件夹,另一个是文件系统中的实际文件夹,但是您在解决方案视图中的结构将遵循文件系统.

Note that "src" folder in the solution view is not the same "src" folder on the disk, one is solution folder and the other is the actual folder in file system, but your structure from solution view will follow structure in the file system.

我希望这会有所帮助:)

I hope that this helps :)

这篇关于如何在解决方案根目录下添加"src"文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆