如何使整个文件夹成为Visual Studio项目中的嵌入式资源? [英] How can I have an entire folder be an embedded resource in a Visual Studio project?

查看:463
本文介绍了如何使整个文件夹成为Visual Studio项目中的嵌入式资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个项目,我们将其称为容器".容器有很多EmbeddedResources.这些EmbeddedResources的原始文件是另一个项目,我们称为FileProject.

I'm working on a project which we'll call Container. Container has a bunch of EmbeddedResources. The original files for these EmbeddedResources are another project which we'll call FileProject.

FileProject是一个项目,当前由一组不同的开发人员进行开发,并且始终处于更改状态,因此我链接了EmbeddedResource文件-这样,无论原始项目何时发生更改,只要我重新构建项目,它都会选择进行更改.

FileProject is a project that is currently being worked on by a group of different developers and is always changing, so I have my EmbeddedResource files linked - so that whenever the original project changes and I do a rebuild of my project, it picks up the changes.

此设置会在文件更改时捕获,但在项目中添加或删除新文件时不会捕获.是否可以通过Visual Studio的整个文件夹结构来制作EmbeddedResources,以捕获文件的删除和添加?

This setup catches whenever a file changes, but it doesn't catch whenever a new file is added or removed from the project. Is there a way to make EmbeddedResources out of an entire folder structure in Visual Studio to catch file removal and additions?

推荐答案

在文本编辑器中编辑Container的项目文件,然后找到链接到FileProject中文件的<EmbeddedResource>元素:

Edit the project file for Container in a text editor and find the <EmbeddedResource> elements that link to the files in FileProject:

<EmbeddedResource Include="..\FileProject\Copy.bmp">
  <Link>Copy.bmp</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\FileProject\Paste.bmp">
  <Link>Paste.bmp</Link>
</EmbeddedResource>

删除所有这些元素,并用具有适当通配符的单个<EmbeddedResource>元素替换它们:

Delete all of these elements and replace them with a single <EmbeddedResource> element that has a suitable wildcard:

<EmbeddedResource Include="..\FileProject\*.bmp" />

现在,如果将Cut.bmp添加到FileProject,它也会显示在Container中.

Now if you add Cut.bmp to FileProject, it will also show up in Container.

这篇关于如何使整个文件夹成为Visual Studio项目中的嵌入式资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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