如何轻松地向项目添加多个资源 [英] How can I easily add multiple resources to my project

查看:93
本文介绍了如何轻松地向项目添加多个资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向Windows"Metro"移植许多应用程序,并且每个应用程序在多个目录(数十个目录和数百个文件)中都有大量资源文件。  我希望能够将所有这些文件添加到我的项目中,而不需要
一次只导入一个文件夹(并将它们设置为'内容')。  我已尝试将资源文件夹的根目录拖到"解决方案资源管理器"中的"资产"文件夹中,但这当然不起作用。  现在,似乎I
必须将所有文件物理复制到我项目的'Assets'文件夹中,然后使用'Add / New Filer'在项目中创建相应的'文件夹' "解决方案资源管理器"中的选项,然后将该文件夹的文件添加到项目
(然后冲洗并重复)。  当然有更好的方法吗?



谢谢。

解决方案

我认为您不能避免手动创建文件夹并将相应的文件放在特定于语言的文件夹中。我可以建议的一件事是,如果你通过windows
资源管理器在文件系统中创建所有文件夹和复制文件,那么在VS的解决方案资源管理器中,你可以点击"显示所有文件"。按钮位于Solution Explorer窗口的顶部,然后右键单击这些文件夹并选择"Include In Project"。这将在项目中标记文件夹中的所有文件
,默认情况下文件如.txt或图像文件标记为内容,因此您无需手动更改它们。


I am porting a number of apps to Windows 'Metro' and each of these apps have a large number of resource files in multiple directories (dozens of directories, and hundreds of files).  I would like to be able to add all of these files to my project without having to import them one folder at a time (and setting them as 'content').  I have tried dragging the root of the resources folder to the 'Assets' folder in the 'Solution Explorer', but that, of course, does not work.  Right now, it seems that I have to physically copy all the files into my 'Assets' folder for my project, and then create the corresponding 'folder' in the project by using the 'Add/New Filer' option in the 'Solution Explorer' and then adding the files for that folder to the project (and then rinse and repeat).  Surely there is a better way to do this?

Thanks.

解决方案

I don't think you can avoid the manual creation of the folders and putting the appropriate files in the language-specific folders. One thing I can suggest is if you do all the creating folders and copying files in the file system via windows explorer, then in Solution Explorer in VS, you can click the "Show All Files" button located at the top of the Solution Explorer window, then right-click on those folders and select "Include In Project". This will mark all the files in the folder to be included in the project and files like .txt or image files are marked as Content by default so you don't need to manually change them.


这篇关于如何轻松地向项目添加多个资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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