有没有办法在visual studio中进行项目到项目的引用,并且仍然只运送带有所需库的产品? [英] Is there a way to make a project-to-project reference in visual studio and still ship a product with only the required libraries?

查看:83
本文介绍了有没有办法在visual studio中进行项目到项目的引用,并且仍然只运送带有所需库的产品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常喜欢保留一个包含可执行文件的解决方案以及他们使用的任何库的所有项目。这样我可以引用库的项目,如果可执行文件需要它,如果我修改库我可以编译解决方案,可执行文件将自动获得更新的库。



我的职责最近已经从支持图书馆扩展到直接包括公司旗舰产品。该产品将在符合客户需求的模块中发布。因此,每个客户都获得主要组件,然后只获得他们订购的模块附带的库。公司这样做有两个原因。一种是使得我们的库更难以反编译,第二种是减少定期发布的更新的大小。



结果几乎所有的库都是通过反射延迟绑定的。这使得确保您使用每个库的当前版本非常困难。有没有办法在Visual Studio中进行项目到项目的引用,仍然只有所需库的产品?



编辑:如果我措辞的话在一种令人困惑或给予大量背景信息的方式中,我的问题与许可或保护无关,而是反编译的代码。我们目前与Reflection的后期绑定仅仅是自己的库,因此我们不必删除不需要的引用并重新编译软件的每个配置。我想知道是否有一种方法可以让我仍然可以进行项目到项目的引用,并且仍然可以完成正在进行的工作。我意识到可能有更好的方法,但这就是我所处的情况,再次感谢你的帮助。



我是什么尝试过:



尝试谷歌搜索,代码项目和堆栈溢出。

解决方案

它取决于你是否可以将你的手动插件机制(我理解你在这里用你的后期绑定程序集实现)更改为更易于管理的插件结构。你有没有使用MEF - 它是.NET的一部分,而且很容易管理 - 所以我有一个类似的功能,我们的客户自动加载客户特定的库,MEF + VS了解它并可以更新它们 - 我正常工作Desing-Time期间的参考和快速调试(我设置了MEF目录以在DEBUG的项目文件夹中找到我的程序集,以及在RELEASE配置中配置的插件文件夹 - 就像在目标系统上一样。)如果你是对这种方法感兴趣我可以分享一些更多的见解;)


客户并不真正关心源代码,或者您正在使用什么工具来编写软件的源代码。 必须提供的主要内容是可执行文件的依赖性。如果可执行文件需要某些东西(例如库的dll),则必须使其可用。如果您不想共享库,那么请确保execute可以本机运行 - 无需运行时或库,这在.NET框架中确实非常困难,并且您也失去了很多可移植性。



因此,如果你的项目引用了一个dll文件,它必须是共享的,否则程序甚至不会(开始)执行。如果你真的想这样做,你可以尝试在可执行文件中嵌入这些代码片段;或者使用资源并将它们嵌入那里 - 我想知道这是否可行。



如果你想让它更难反编译(当然是在.NET中),你可能想要使用其他一些服务,比如 Dotfuscator [ ^ ],这将使您最终用户难以对传送到其计算机的库或其他软件包进行反编译。但是知道这一点,他们仍然可以反编译最大的程序集。



如果您编写的程序集依赖于其他程序集,那么也会应用许可证。请确保您遵守这些许可证 - 例如,按原样共享软件。最后,用户仍然有机会打破代码,看看那里写的是什么。



反思另一方面,并​​不保证你可以简单地逃脱而不会反编译代码。反射有其他用途,而且......好吧,它只是在你的情况下没有正确使用。 : - )

I generally like to keep one solution that contains executable's and all the projects for any library's they use. This way I can reference the library's project if an executable needs it and if I modify a library I can compile the solution and the executable's will get the updated library automatically.

My responsibilities have recently expanded from just supporting library's to include working on the companies flag ship product directly. This product gets released in modules that are configured to the customers needs. So every customers get the main components and then only the libraries that come with the modules they've ordered. The company has done this for two reasons. One is to make it harder to obtain our libraries to decompile and the second is to reduce the size of updates that are released periodically.

As a result almost all of are libraries are late bound through reflection. This has made it very difficult make sure you're working with the current version of every library. Is there a way to make a project-to-project reference in Visual Studio and still ship are product with only the required libraries?

Edit: In case I worded it in a way that is confusing or gave to much background information my questions way not about licenses or protecting are code from decompile. We are currently late binding with Reflection only to are own libraries and so we don't have to remove unneeded references and recompile for every configuration of the software. I'm want to know if there is a way that I can still make project-to-project references and still accomplish what were doing. I realize that there is probably a better approach over all, but this is the situation I'm in and thank you again for your help.

What I have tried:

Tried Googling, Code Project and Stack Overflow.

解决方案

It depends if you can change your manual Plugin-mechanism (what I understand you achieve here with your "late-binding" assemblies) to a more managable plugin-structure. have you ever used MEF - it's part of .NET and quite easy to manage - So I have a similar feature for our customers where customer specific libs are loaded automatically by MEF + VS knows about it and can update them - I work with normal project references during Desing-Time and for quick Debugging (I set up the MEF "catalog" to find my assemblies in the Project Folders for DEBUG, and a configured "Plugin" Folder in RELEASE configuration - like on the target systems.) If you are interested in this approach I can share some more "insights" ;)


Customers do not really care about the source code, or what tools you are using to write the software's source code. The main thing that must be provided is the dependency of the executable. If the executable needs something (such as a dll for a library), it must be made available. If you do not want to share the libraries, then make sure that the execute can run natively — without the need of a runtime or library, which in .NET framework is really very tough job and you also lose much of portability.

So, if your project is referencing a dll file, it must be shared, otherwise program won't even (start to) execute. If you really want to do this, you can try to embed those code snippets inside the executable; or use the resources and embed them there — I wonder if this is even possible.

If you want to make it harder to decompile (in .NET of course), you may want to use some other services, such as Dotfuscator[^], that would let you to make it difficult for the end user to decompile the libraries or other software packages that are delivered to their machines. But know this, they can still decompile maximum of the assemblies.

If the assemblies, that you wrote depend on other assemblies, then there are licenses applied to them as well. Make sure, you abide to follow those licenses as well — such as, share the software as-is. Finally, the user can still have his/her chance to break the code and see what is written there.

Reflection on other hand, does not guarantee that you can simply get away and not have the code decompiled. Reflection has other uses, and... Well, it was just not used properly in your case. :-)


这篇关于有没有办法在visual studio中进行项目到项目的引用,并且仍然只运送带有所需库的产品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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