如何从用于构建目的的解决方案中获取最低级别的项目?
如果我有一个包含多个项目的 Visual Studio 解决方案,那么在构建解决方案后,如何从项目中找出哪一个将拥有所有 dll?
原因是我需要为我的自定义编写的构建应用程序复制这些 dll。我知道在 Visual Studio GUI 中,如果我右键单击解决方案并转到“项目构建顺序”,最低级别的项目将是包含已构建 dll 和引用 dll 的完整列表的项目。那么我可以使用任何逻辑通过代码来解决这个问题吗?
If I have a visual studio solution with a multiple projects, from the projects how do I figure out which one will have all the dlls once the solution is built?
The reason is I need to copy those dll's for my custom written build app. I know in the Visual studio GUI, if I right click on the solution and go to Project Build Order, the lowest level item will be the project which will have the complete list of built dll's and referenced dll's. So is there any logic I can use to work this out through code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以编写一些代码来读取解决方案/项目文件(格式并不难)并自己计算出依赖关系树。
但是,更好的方法是通过更改 Visual Studio 中的生成属性来将所有项目更改为输出到公共 \bin 目录。这可以避免您在各个单独的项目 bin 目录中拥有大量二进制文件副本,并且当项目增长到需要拆分为多个解决方案的大小时,工作会变得更加轻松。
如下所示的目录结构通常很有用:
You could write some code to read the solution / project files (the formats are not hard) and work out the dependency tree yourself.
However, a better approach is to change all the projects to output to a common \bin directory to start with by altering the build properties in Visual Studio. This avoids you having numerous copies of binaries in various individual project bin directories and makes life easier when it grows to a size where you need to split into multiple solutions.
A directory structure something like the following is often useful: