How to package all the DLL files into an EXE and run it for the customer?

Source: Internet
Author: User
How to package all the DLL files into an EXE and run it for the customer? (Transfer)

Generally, write a winformProgramMultiple DLL files are referenced. If you publish this winform, there will be many DLL files in a directory.

What should I do if I want to just upload a client.exe?

It is easy to package the DLL into the EXE as a resource.

Then the question is how you can load these DLL files at runtime.

One feasible method is to load all the DLL files at a time when the program is running, and then load it with appdomain. Load.

However, a bad thing is that the startup speed is too slow.

Appdomain provides an event called assemblyresolve, which tells you that DOTNET cannot find the Assembly it is looking.

By associating this event, compare whether resolveeventargs. Name is the one you packed, and then load the DLL as needed.

For example, download resofdll.zip

Of course, if you develop DLL and reference others' DLL, you can also do this. However, you must ensure that the assemblyresolve event is associated before using other DLL classes. (This can be executed in the static constructor of all classes that use other DLL classes.CodeTo ensure this condition)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.