简体   繁体   English

C#将DLL与关联的库一起保存

[英]C# Keeping DLLs with the associated library

We have a library built on the back of eldos' Secure Black Box. 我们在eldos的Secure Black Box背面建立了一个图书馆。 We use copy local to ensure that the appropriate runtime DLLs are included. 我们使用本地复制来确保包含适当的运行时DLL。

If we now reference our library in another project with a copy local our library is copied into the bin folder of our main project but the Eldos SBB libraries aren't. 如果现在我们在另一个具有本地副本的项目中引用我们的库,则我们的库将被复制到主项目的bin文件夹中,而Eldos SBB库则没有。 We could reference SBB in the main project but there are no direct calls to SBB so any time the code is refactored the references may be removed as unused. 我们可以在主项目中引用SBB,但是没有直接调用SBB的信息,因此,只要代码重构,引用就可能被删除为未使用的。

What is the best way of handling this issue? 处理此问题的最佳方法是什么?

Simon 西蒙

One way to do it would be to put an msbuild script entry into the project properties--> build events --> pre or post build event dialog which would handle copying your Eldos SBB libraries for you. 一种方法是将msbuild脚本条目放入项目属性->构建事件->生成事件之前或之后的对话框,该对话框将为您处理Eldos SBB库的复制。 This way you dont have and explicit reference that might get removed, although someone can remove the script so nothing is 100%. 这样,您就没有可能会删除的显式引用,尽管有人可以删除脚本,所以没有什么是100%。

So your script might look something like this: 因此,您的脚本可能看起来像这样:

copy "{path1}EldosSBB.dll" "{path2}EldosSBB.dll"

Enjoy! 请享用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM