Visual Studio 中的解决方案文件夹是什么?
我有一个 Visual Studio 2008 解决方案,我想在解决方案中包含一个真实的文件夹,但不是在项目级别,而是在解决方案级别。
我注意到您可以右键单击解决方案并添加一个解决方案文件夹,但它显示为一些白色文件夹,我怀疑它到底应该是什么......
基本上在文件系统上我有 c:\ mySolution\myFolder...
我希望将 myFolder 添加到解决方案中,以便项目也受到源代码控制...
I have a Visual Studio 2008 solution, and I would like to include a real folder in the solution, but not at the project level, instead at the solution level.
I noticed you can right click the solution and add a solution folder, but it comes up as some white folder, and I have my doubts as to exactly what it is supposed to be...
Basically on the file system I have c:\mySolution\myFolder...
I want that myFolder is added to the solution, so that items are also under source control...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我还希望能够将物理文件夹添加到解决方案中,但不幸的是您无法在项目之外执行此操作。
我发现的最佳解决方案是添加一个与物理文件夹(示例中为 myFolder)同名的解决方案文件夹,然后将该物理文件夹中的文件添加到解决方案文件夹中。
但是,Visual Studio 不维护解决方案文件夹和物理文件夹之间的映射,这意味着:
随后使用 Visual Studio 在解决方案文件夹中创建的新文件不会自动放置在物理子文件夹中(我认为它们是在默认情况下解决方案根文件夹)
添加到即使使用“显示所有文件”,物理文件夹也不会自动在解决方案文件夹中可见。
即使使用
因此,要添加新文件,我总是在 Visual Studio 外部的物理文件夹中创建新文件,然后使用“添加/现有项目”将其添加到解决方案文件夹中
I also would like to be able to add physical folders to a solution, but unfortunately you can't do so outside a project.
The best solution I have found is to add a solution folder with the same name as the physical folder (myFolder in your example), then add files from that physical folder to the solution folder.
However Visual Studio does not maintain a mapping between the solution folder and the physical folder which means that:
new files subsequently created in the solution folder using Visual Studio are not automatically placed in the physical subfolder (I think they are created in the solution root folder by default)
files added to the physical folder are not automatically visible in the solution folder, even with "Show All Files".
To add new files, I therefore always create the new file in the physical folder outside Visual Studio, then add it to the solution folder using "Add/Existing Item"
我过去所做的就是创建一个仅保存文件(DLL 等)的项目,
您也可以这样做。 该项目可以命名为您尝试创建的任何文件夹。
What I have done historically is to create a project for just holding files (DLLs, etc.)
You can do that as well. This project can be named as whatever folder you are trying to create.
按照此操作...
然后新项目将被放入新的
新物理文件夹
中。Follow this...
Then the new project will be put inside your new
New Physical Folder
.您还可以在解决方案文件夹中添加独立文件,它们将受到源代码控制。 但请注意,VS 倾向于将这些文件与解决方案文件放在同一文件夹中 - “解决方案文件夹”是虚拟的,与真实的文件系统文件夹不对应。 要拥有真正的文件系统文件夹,我认为您必须自己创建结构,然后选择“添加现有项目”。
You can also add standalone files in a solution folder, and they will be source-controlled. But be wary that VS tends to put these files in the same folder as the solution file - the "Solution Folders" are virtual and don't corresspond to real filesystem folders. To have a real filesystem folders I think you would have to create the structure yourself and then choose "Add Existing Item".
我首选的解决方案是添加一个共享项目,它就像一个文件夹,但带有特殊的图标。
My prefered solution is to add a Shared project, which is like a folder but with a special icon.
来自 MSDN:
您不想要作曲家在解决方案文件夹中的意思。 这使得他们将大型解决方案组织成组。
对于您的问题,我认为这是您的安装项目收集这些文件的工作:安装说明、全局帮助等......
From MSDN:
You don't want what the composer meant in Solution Folder. It made them to organize large solutions into groups.
For your problem, I think this is the job for your Installation Project to collect these files: Installation instructions, Global help, etc...
您可以使用解决方案文件夹对解决方案中的文件进行分组,但解决方案文件夹并不代表磁盘上的文件夹,如其徽标所示。 (它可以包含文件引用和项目引用。)
You can use a solution folder to group files in a solution, but a solution folder doesn't represent an on-disk folder, like its logo suggests. (It can contain file references and project references.)
创建您的解决方案
例如您的解决方案文件夹路径 C:\Projects\demoProjectName>
在同一解决方案路径中创建项目
从解决方案文件夹路径中执行此操作
请注意:所使用的持久性只是您的项目名称的占位符。 classlib 用于 classLibrary 项目,它可以是控制台项目等。
Create your Solution
e.g. Your solution folder path C:\Projects\demoProjectName>
Create a Project within the same solution Path
From your solution folder path, do this
Please note: Persistence as used is just a placeholder for your project name. classlib for classLibrary projects and it could be a console project and so on.