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

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

问题描述

我们假设我有一个C#Winforms项目,MainGUI。



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



ControlsLib引用第三方控件套件,例如Infragistics或Telerik控件,并公开一组用于MainGUI的用户控件。



复制ControlLib中的所有引用都将Local设置为true,并且所有第三方DLL都显示在ControlsLib\bin\release中。



但是我无法获得第三方DLL将自动复制到MainGUI\bin\release,这是生成软件安装程序的文件夹(在这种情况下使用NSIS)



因此,第三方控制DLL不包括在安装中,这导致在运行时导致FileNotFoundException在控制来自依赖于第三方DLL的ControlsLib时。



有没有正确的做法,我不知道吗?以前,我刚刚通过复制文件处理这个nant构建脚本,但是我正在开始一个新项目,我只是想检查。



谢谢


解决方案

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

  copy $(SolutionDir)ControlsLib\bin\ $(ConfigurationName)\Infragistics2 * .dll $(TargetDir )

我没有意识到这样做真的很容易...


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

It references another project in the same solution, ControlsLib.

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.

Copy Local is set to true on all the references in ControlsLib, and all the third party DLLs appear in ControlsLib\bin\release.

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

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.

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.

Thanks

解决方案

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)ControlsLib\bin\$(ConfigurationName)\Infragistics2*.dll $(TargetDir)

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

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

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