VS2008.NET:获取引用项目的依赖项以复制到主项目的 bin 文件夹 [英] VS2008.NET: Getting a referenced project's dependencies to copy to main project's bin folder

查看:35
本文介绍了VS2008.NET:获取引用项目的依赖项以复制到主项目的 bin 文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个 C# Winforms 项目 MainGUI.

Let's assume I have a C# Winforms project, MainGUI.

它引用了同一解决方案中的另一个项目,ControlsLib.

It references another project in the same solution, ControlsLib.

ControlsLib 引用了第三方控件套件,例如 Infragistics 或 Telerik 控件,并公开了一组在 MainGUI 中使用的用户控件.

ControlsLib references a third party control suite, such as Infragistics or Telerik controls, and exposes a set of user controls, that are used in MainGUI.

ControlsLib 中所有引用的 Copy Local 设置为 true,所有第三方 DLL 都出现在 ControlsLibin elease 中.

Copy Local is set to true on all the references in ControlsLib, and all the third party DLLs appear in ControlsLibin elease.

但是我无法让第三方 DLL 自动复制到 MainGUIin elease,这是生成软件安装程序的文件夹(在本例中使用 NSIS)

However I cannot get the third party DLLs to copy automatically to MainGUIin elease, which is the folder from which the software's installer is generated (in this case using NSIS)

因此,第三方控件 DLL 不会包含在安装中,当使用 ControlsLib 中依赖于第三方 DLL 的控件时,这会导致运行时出现 FileNotFoundException.

Therefore the third party control DLLs don't get included in the installation, which leads to a FileNotFoundException at runtime when controls from ControlsLib that depend on the third party DLLs are used.

是否有我不知道的正确"方法来做到这一点?以前我只是在一个 nant 构建脚本中通过复制文件来处理这个问题,但我正在开始一个新项目,我只是想检查一下.

Is there a "proper" way to do this that I'm not aware of? Previously I've just handled this in a nant build script by copying files around, but I'm starting a new project and I just wanted to check.

谢谢

推荐答案

我刚刚通过将以下构建后事件命令行添加到 MainGUI 的 .csproj 文件中解决了这个问题(项目属性 -> 构建事件)

I have just solved this by adding the following post build event command line to the .csproj file for MainGUI (project properties -> build events)

copy $(SolutionDir)ControlsLibin$(ConfigurationName)Infragistics2*.dll $(TargetDir)

我没有意识到这样做实际上如此简单......

I hadn't realised doing that was so easy actually...

这篇关于VS2008.NET:获取引用项目的依赖项以复制到主项目的 bin 文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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