简体   繁体   English

项目级别的Visual Studio解决方案文件夹

[英]Visual studio solution folder at the project level

In Visual Studio (2010) is it possible to create a "Solution Folder" at the project level? 在Visual Studio(2010)中,是否可以在项目级别创建“解决方案文件夹”?
A "virtual" project folder within Visual Studio? Visual Studio中的“虚拟”项目文件夹?

The problem: 问题:

We have a project in our solution which contains all our culture resource files. 我们的解决方案中有一个项目,其中包含我们所有的文化资源文件。 We employ a single resource file per business purpose, ie we have more than one resource file representing each culture. 我们为每个业务目的使用单个资源文件,即我们有多个代表每种文化的资源文件。

As resource files for different cultures have to be stored at the same location (path) this results in or project containing many resource files at the root level. 由于不同文化的资源文件必须存储在同一位置(路径),因此这会导致或项目在根级别包含许多资源文件。 This is fine for the time-being but as we add support for different cultures the number of resource files will grow to an unmanageable number 暂时没问题但是当我们添加对不同文化的支持时,资源文件的数量将增加到无法管理的数量

So in order to better organize our project we'd like to create a "virtual" folder at the project level where we can create one folder per culture. 因此,为了更好地组织我们的项目,我们想在项目级别创建一个“虚拟”文件夹,我们可以在每个文化中创建一个文件夹。 Is this possible? 这可能吗?

Any thoughts? 有什么想法吗?

I'm pretty sure you can't. 我很确定你做不到。 This has always been a odd nuance to me of VS, that the folders in solutions are virtual, yet the Project folders are not. 这对我来说一直是一个奇怪的细微差别,解决方案中的文件夹是虚拟的,但Project文件夹却不是。 I don't like the virtual folders anyways, because you can run into strange nuances because your physical moving of files doesn't stay in sync with the structure in the virtual folders. 我不喜欢虚拟文件夹,因为你可能会遇到奇怪的细微差别,因为文件的物理移动不会与虚拟文件夹中的结构保持同步。 Has caused me headaches. 让我头痛。 I've always wished there were physical folders at the solution level for putting things shared across projects. 我一直希望解决方案级别有物理文件夹,以便在项目中共享内容。

Step 1) If they just need to be all in the same physical folder, then to start with I would move them into a Resources subfolder of the project. 步骤1)如果他们只需要在同一个物理文件夹中,那么首先我将它们移动到项目的Resources子文件夹中。 I keep very little in the root of my projects. 我对项目的根本保持不变。 Even source code goes into a "src" folder. 甚至源代码也会进入“src”文件夹。 Leaving only things like *.config files in the root. 只留下根目录中的* .config文件。

Step 2) Create several virtual folders as needed at the solution level where you drag the files from the project into it's appropriate virtual solution folder. 步骤2)在解决方案级别根据需要创建多个虚拟文件夹,将文件从项目拖动到适当的虚拟解决方案文件夹中。 The file will still physically exist and show in the "Resources" folders at the project, but for more user friendly browsing of the files, they will exist in the virtual folders which just references the original file. 该文件仍然存在并显示在项目的“Resources”文件夹中,但是为了更友好地浏览文件,它们将存在于仅引用原始文件的虚拟文件夹中。

I realize this is less than ideal, but thought I'd point out that nothing is stopping you from using the solution level folders while having the files exist physically in the project. 我意识到这不太理想,但我想我会指出,没有任何东西阻止你使用解决方案级别文件夹,同时文件存在于项目中。

But as I mentioned, if you add new resources files to your project, you will always need to take that extra step of "categorizing" them by dragging them into a virtual solution folder. 但正如我所提到的,如果您将新资源文件添加到项目中,您将始终需要采取额外的步骤,通过将它们拖放到虚拟解决方案文件夹中来“分类”它们。 This is one of those things that is likely to get out of sync because you will forget about these if you go a few weeks without touching this project. 这是可能会失去同步的事情之一,因为如果你在没有触及这个项目的情况下花几周时间就会忘记这些。

A better solution might be to use some sort of custom build step, maybe with nant or msbuild, that takes Resources stored in phyiscally seperate resource folders and copies them into a single resource folder before compilation. 一个更好的解决方案可能是使用某种自定义构建步骤,可能使用nant或msbuild,它将资源存储在phyiscally单独的资源文件夹中,并在编译之前将它们复制到单个资源文件夹中。 This way you create resources in each subfolder, and the build step automatically copies them into the single destination folder. 这样,您可以在每个子文件夹中创建资源,并且构建步骤会自动将它们复制到单个目标文件夹中。

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

相关问题 将解决方案文件夹添加到visual studio项目模板 - Add solution folder to visual studio project template 在Visual Studio项目模板中创建解决方案文件夹 - Create a Solution Folder in a Visual Studio Project Template 从Visual Studio中的解决方案文件夹创建项目模板 - Create Project template from solution folder in visual studio 如何在Visual Studio解决方案的项目中检查文件是否存在于文件夹中 - How to check if file exists in a folder in my project in Visual Studio solution Visual Studio 将项目文件夹复制到 Output 目录(WPF 解决方案) - Visual studio Copying a project folder to Output Directory (WPF solution) 在 Visual Studio 中重命名项目/解决方案 - Renaming project / solution in Visual studio 如何从C#项目的构建事件中访问Visual Studio解决方案级平台? - How can you access the Visual Studio solution level platform from a C# project's build event? Visual Studio,将解决方案复制到内部版本的文件夹 - Visual Studio, Copy Solution to Folder On Build 使用Solution.Folder的Visual Studio - Visual Studio using Solution.Folder 消除visual studio解决方案文件夹中的临时文件 - Eliminate temporary files in visual studio solution folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM