合并 DLL 和 .cs 文件

发布于 2024-09-09 00:36:11 字数 655 浏览 4 评论 0原文

大项目的一部分是支付系统,我想重用它。我想将该支付系统的所有类文件合并到 DLL 中,以便将它们添加为所有其他项目中的引用。当前的支付系统还使用商业应用程序(nsoftware-paypal 等)的 DLL 中的命名空间。我尝试使用 csc 将各个文件编译成 DLL,但无法使其工作。我还尝试了 ILMerge < /a> 但这似乎也不起作用。

CSC

由于 .cs 文件使用 nsoftware-Paypal 的 DLL 中的命名空间,因此我将 DLL 文件与 .cs 一起包含在 csc 命令中。它给我一个错误,说“...nsoftware.InPayPal.dll 是一个二进制文件而不是文本文件”。当我尝试在没有 paypal DLL 的情况下进行编译时,它会抛出错误,提示“缺少名为 nsoftware 的类型或命名空间”。

ILMerge 也不允许 .cs 文件(因为它当然不是程序集)。

我需要做的就是为整个系统生成一个(或多个)DLL,以便我可以在其他项目中使用它。

可能的?

A part of big project is a payment system, that I would like to reuse. I want to merge all the class files of this payment system into DLLs so that add them as a reference in all the other projects. The present payment system is also using namespaces from the DLLs of a commercial application (nsoftware-paypal n few others). I tried csc to compile the individual files into DLLs but couldnt make it work. I also tried the ILMerge but this doesnt seem to work either.

CSC

As the .cs files uses the namespaces from the DLLs of nsoftware-Paypal, I included DLL files along with .cs in csc command. it gives me an error saying "...nsoftware.InPayPal.dll is a binary file instead of a text file". When I try to compile without the paypal DLLs it throws an error saying 'The type or namespace named nsoftware is missing'.

ILMerge does not allow the .cs files either(as its not an assembly of course).

All I need to do is to generate the one(or more) DLLs for this whole system so that I can use it in other projects.

Possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你是年少的欢喜 2024-09-16 00:36:11

您需要使用 csc 编译 .cs 文件,然后使用 ILMerge 将第 3 方程序集与生成的程序集合并。

仅供参考,ILMerge 有一个开源 GUI,可以使事情变得更容易(至少在一开始)。

http://sourceforge.net/projects/gilma/

关于您可能想要的编译问题查看此 教程

为了使用 dll 编译代码,请执行以下操作

csc /out:out.exe /r:third_party_dll.dll program.cs

you need to compile your .cs files using csc, then use ILMerge to combine the 3rd party assemblies with your generated assembly.

fyi there is an open source gui for ILMerge that can make things a little easier (at least at first).

http://sourceforge.net/projects/gilma/

In regards to your compilation issues you might want to check out this tutorial

in order to compile your code with a dll do something like this

csc /out:out.exe /r:third_party_dll.dll program.cs
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文