Visual Studio 2008:如何将项目输出作为嵌入式资源包含在另一个项目中? [英] Visual Studio 2008: How do I include project output as an embedded resource in another project?

查看:198
本文介绍了Visual Studio 2008:如何将项目输出作为嵌入式资源包含在另一个项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个Visual Studio 2008解决方案中有两个项目。我想使用其中一个项目的主要输出作为另一个项目的嵌入式资源,但对于我来说,我找不到任何方法来实现这一点。



如果我只是将输出文件添加为资源,那么在重建源项目时似乎不会改变。我甚至有项目依赖/建立顺序设置正确,这似乎没有帮助。



任何人都有任何提示吗?



谢谢!

解决方案

将现有文件添加到项目中,Visual Studio将文件复制到项目的目录。

原始文件的任何后续更改都将被忽略。



有两种解决方法:




  • 将第一个项目添加到第一个项目,将其输出文件复制到第二个项目,并编辑依赖关系,以便始终构建第一个项目。


  • 将输出文件添加到第二个项目作为链接(单击打开的对话框中的添加按钮旁边的向下箭头)。

    这将从原始位置引用该文件,而不进行任何复制。



I have two projects in one Visual Studio 2008 solution. I'd like to use the primary output from one of the projects as an embedded resource in the other, but for the life of me I can't find any way to accomplish this.

If I simply add the output file as a resource, then it doesn't seem to change when its source project is rebuilt. I even have the project dependencies/build order set up properly and this does not seem to help.

Anyone have any hints for me?

Thanks!

解决方案

When you add an existing file to a project, Visual Studio copies the file into the project's directory.
Any subsequent changes to the original file are ignored.

There are two workarounds:

  • Add a post-build action to the first project that copies its output file to the second project, and edit the dependencies so that the first project is always built first.

  • Add the output file to the second project as a link (Click the down arrow next to the Add button in the open dialog).
    This will reference the file from its original location without making any copies.

这篇关于Visual Studio 2008:如何将项目输出作为嵌入式资源包含在另一个项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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