C # encapsulates an existing program as a DLL file for other programs to call
If the development of the program is very large, the function is very complex, the load is very slow, the user feel bad, so you can separate some features, packaged as a DLL file, when the program runs when necessary to call, speed up the program response.
Search on the Internet, in fact, the process is relatively simple:
Open a line under the project---solution---properties---application---Modify the output type to class library, F5 compile the program.
At this point, you will be prompted with the following error:
---------------------------
Microsoft Visual Studio
---------------------------
The project with the class library output type cannot be started directly.
To debug this project, add an executable project that references the library project in this solution. Set the executable project as the startup Project.
---------------------------
Are you sure
---------------------------
This error message does not need to be checked, now in the folder where the program is viewed, DLL files have been generated.
After testing, the above method generates DLL files that other programs can call and open normally.
Call Procedure:
(assuming that the generated DLL file is "Aaa.dll" and AAA is the namespace name)
1, the new procedure;
2. Add Reference: Add the Aaa.dll file to the reference;
3, add header file: Using AAA;
4. Call: Add the following code where needed:
Aaa. Form1 MyForm2 = new AAA. Form1 ();
Myform2.show ();
C # encapsulates an existing program as a DLL file for other programs to call