VS2010 构建解决方案 - 将文件添加到 BIN 文件夹

发布于 2024-09-30 13:00:54 字数 205 浏览 9 评论 0原文

我们有一个由 Windows 应用程序和各种库文件组成的解决方案。并非所有库文件都被主 Windows 应用程序引用,但是我们希望将所有库文件包含在输出构建文件夹“bin”中。

显然,一种解决方案是简单地引用 Windows 应用程序中的每个库,但我们希望避免任何不必要的引用。

我们如何将其他文件包含到我们的构建文件夹中?

这是一个 C# 项目。

We have a solution comprising of a windows application and various library files. Not all of the library files are referenced by the main windows application however we would like to have all the library files included in the output build folder "bin".

Obviously one solution is to simply reference every single library from the Windows application however we would like to avoid any unnecessary referencing.

How can we include additional files into our build folder?

This is a C# project.

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

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

发布评论

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

评论(2

柏拉图鍀咏恒 2024-10-07 13:00:54

您始终可以使用项目设置中的预构建或构建后事件来复制其他文件。

您可以简单地通过执行一堆复制源目标来完成此操作,或者您甚至可以编写一个 nmake 文件。但是,您确实必须维护源文件列表...

编辑:

另一种想法。您的假设是这是“不必要的引用”。但是,如果你的应用程序依赖这些程序集来运行,无论它们是否是编译时引用,那么这些依赖项不就成为“必要”引用了吗?在这种情况下,将它们添加为参考并让 Studio 的构建系统为您工作不是最好(也是最简单)的方法吗?

You can always use the pre-build or post-build events in the project settings to copy the additional files.

You can do this simply by doing a bunch of copy source target, or you could even be fancy and write an nmake file. You do have to maintain the list of source files however...

Edit:

One other thought. Your assumption is that this is "unnecessary referencing". However, if your application depends on these assemblies to run, whether or not they are compile time references, then don't these dependencies become "necessary" references? In that case, isn't adding them as references and letting Studio's build system work for you the best (and simplest) approach?

偏闹i 2024-10-07 13:00:54

解决方案是将解决方案中所有“库”的构建位置更改为主输出“bin”位置。主 Windows 应用程序仅引用它所依赖的库,但是所有库都构建到一个“公共”位置。

感谢 Nader Shirazie 帮助解答这个问题。

The solution was to change the build location for all "libraries" within the solution to the main output "bin" location. The main Windows application only references the libraries that it depends upon however all the libraries are built to the one "common" location.

Thanks to Nader Shirazie for help with this question.

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