如何更改引用dll被复制到的位置? [英] how to change the location that the references dlls are copied to?

查看:169
本文介绍了如何更改引用dll被复制到的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一些库,我添加了对该库DLL的引用,我将Copy Local复制到true。

但是我想将dll的位置更改为子文件夹exe文件夹,而不是与exe。

这是可能的吗?

谢谢



更新:

i使用以下建立后的事件[作为Jon Skeet推荐]

  move / y $(TargetDir)\System .Data.SqlServerCe.dll $(TargetDir)\Lib\SqlSrvCe\System.Data.SqlServerCe.dll 


解决方案

您将需要.exe文件,以便探测路径被更改。一个子目录没有问题,只需使用< probing> 元素,其privatePath属性就是一个相对的文件夹名称。



然而,请注意,您将从IDE中获得很少的帮助,将DLL放在该位置。你需要一个后期制作事件,如果需要的话可以创建该文件夹,并且xcopy是那个DLL。这样的东西:

 如果不存在$(TargetDir)mumblemkdir$(TargetDir)mumble
xcopy / d / y$(TargetDir)something.dll$(TargetDir)mumble


i am using some libraries and i added a reference to that library dll and i set the "Copy Local" to true.
but i want to change the location of the dll to be a subfolder in the exe folder and not with the exe.
how is this possible?
thanks

Update:
i used the following Post-build event [as Jon Skeet recommended]

move /y $(TargetDir)\System.Data.SqlServerCe.dll   $(TargetDir)\Lib\SqlSrvCe\System.Data.SqlServerCe.dll

解决方案

You'll need a .config file for your .exe so that the probing path is changed. A subdirectory is no problem, just use the <probing> element, its privatePath attribute is a relative folder name.

Beware however that you'll get little help from the IDE to put the DLL in that spot. You'll need a post build event that creates the folder if necessary and xcopy's the DLL there. Something like this:

if not exist "$(TargetDir)mumble" mkdir "$(TargetDir)mumble"
xcopy /d /y "$(TargetDir)something.dll" "$(TargetDir)mumble"

这篇关于如何更改引用dll被复制到的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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