我想知道我们是否只能在没有任何库文件的情况下构建单个EXE文件,例如dll文件? 在构建庞大而复杂的应用程序时,这是有用且必要的。但我的应用程序足够小,只能构建为单个EXE文件,我使用自己的库(大小约为13KB)编写我的应用程序,起初我认为在构建时,编译器会在我的应用程序中包含该库但是它没有。你能告诉我如何在建造时将它包含在我的应用程序中吗?我不想重写代码(另外,它涉及我在我的应用程序中使用的控件,它正是我的自定义TextBox) 非常感谢你!
I wonder if we can build a single EXE file only without any library files going with it such as dll files? When building a huge and complex application, that's useful and necessary. But my application is small enough to build as a single EXE file only, I have used my own library (its size is about 13KB) to write my application, at first I thought when building, the compiler will include that library in my application but it doesn't. Could you please tell me how I can include it in my application when building? I don't want to rewrite code (plus, it concerns my controls I have used in my app, it's exactly my custom TextBox) Thank you so much!
推荐答案您需要ILMerge。请注意,这只有在dll是dll管理的情况下才有可能。 查看以下CodeProject文章解释这一点: 使用ILMerge合并.NET程序集 [ ^ ] 编辑:<一个DLL可以是一个基于的dll(托管dll - 一个带有CLR头)或一个标准DLL(例如mscorlib.dll,kernel32.dll,一个例子是mscorlib.dll,kernel32.dll, user32.dll等)。以下是SO的链接,讨论了基于CLR的dll stackoverflow/questions/330032/checking-if-a-file-is-a-net-assembly [ ^ ] 正如Pete O'Hanlon所说,您可能还会将类库中的所有源文件(或单独的必需文件)包含到您的项目中,这样您就不需要了额外的DLL。 希望这会有所帮助! You need ILMerge. Note that this is possible only if the dll's are managed dll's. Check out the following CodeProject article that explains this: Merging .NET assemblies using ILMerge[^] A DLL could either be a based dll (managed dll - one with CLR header) or a standard DLL (an example is mscorlib.dll, kernel32.dll,user32.dll etc). Following is a link to SO, that discusses about CLR based dll's stackoverflow/questions/330032/checking-if-a-file-is-a-net-assembly[^] As Pete O'Hanlon said, you may also include all of the source files(or the required ones alone) in your class library to your project so that you don't need an additional DLL. Hope this helps!
如果你担心的是你的应用程序中包含的功能,那么您只需将代码文件作为链接代码添加到项目中即可。通过从项目中选择添加现有项,并从插入按钮下拉列表中选择插入链接,这很容易做到这一点。通过这样做,您可以将实际的源文件添加到项目中。 If all you're worried about is including the functionality inside your application, then you could simply add the code files into your project as linked code. It's easy enough to do this, by choosing Add existing item from the project, and choose Insert as Link from the Insert button dropdown. By doing this, you can add the actual source files into your project.
[回答后续问题]
更多推荐
如何在没有任何封闭的dll文件的情况下构建单个EXE文件?
发布评论