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

发布于 2024-12-12 10:44:11 字数 347 浏览 1 评论 0原文

在 Visual Studio (2010) 中是否可以在项目级别创建“解决方案文件夹”?
Visual Studio 中的“虚拟”项目文件夹?

问题:

我们的解决方案中有一个项目,其中包含所有文化资源文件。我们为每个业务目的使用一个资源文件,即我们有多个代表每种文化的资源文件。

由于不同区域性的资源文件必须存储在同一位置(路径),这会导致项目在根级别包含许多资源文件。暂时这很好,但随着我们添加对不同文化的支持,资源文件的数量将增长到难以管理的数量

因此,为了更好地组织我们的项目,我们希望在项目级别创建一个“虚拟”文件夹我们可以在其中为每种文化创建一个文件夹。这可能吗?

有什么想法吗?

In Visual Studio (2010) is it possible to create a "Solution Folder" at the project level?
A "virtual" project folder within 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, i.e. 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笙痞 2024-12-19 10:44:12

我很确定你不能。这对我来说一直是 VS 的一个奇怪的细微差别,解决方案中的文件夹是虚拟的,但项目文件夹不是。无论如何,我不喜欢虚拟文件夹,因为您可能会遇到奇怪的细微差别,因为文件的物理移动与虚拟文件夹中的结构不保持同步。已经让我头疼了。我一直希望解决方案级别有物理文件夹,用于放置跨项目共享的内容。

步骤 1) 如果它们只需要位于同一个物理文件夹中,那么首先我会将它们移动到项目的 Resources 子文件夹中。我在项目的根源上保留的很少。甚至源代码也会进入“src”文件夹。仅在根目录中保留 *.config 文件之类的内容。

步骤 2) 根据需要在解决方案级别创建多个虚拟文件夹,将文件从项目拖动到相应的虚拟解决方案文件夹中。该文件仍然物理存在并显示在项目的“资源”文件夹中,但为了更方便用户浏览文件,它们将存在于仅引用原始文件的虚拟文件夹中。

我意识到这并不理想,但我想我会指出,当文件物理存在于项目中时,没有什么可以阻止您使用解决方案级别文件夹。

但正如我所提到的,如果您将新的资源文件添加到项目中,则始终需要采取额外的步骤,通过将它们拖到虚拟解决方案文件夹中来对它们进行“分类”。这是可能不同步的事情之一,因为如果你几个星期没有接触这个项目,你就会忘记这些。

更好的解决方案可能是使用某种自定义构建步骤,可能使用 nant 或 msbuild,它将存储在物理上独立的资源文件夹中的资源并在编译之前将它们复制到单个资源文件夹中。通过这种方式,您可以在每个子文件夹中创建资源,并且构建步骤会自动将它们复制到单个目标文件夹中。

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. 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. I keep very little in the root of my projects. Even source code goes into a "src" folder. Leaving only things like *.config files in the root.

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. 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.

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. This way you create resources in each subfolder, and the build step automatically copies them into the single destination folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文