Home > Mobile >  Including .dll files in C# Forms Application
Including .dll files in C# Forms Application

Time:10-26

I am using Visual Studio 2019 to build a C# Forms application. When publishing an .exe file from a Console application, I have the option to include all the .dll files into the .exe, meaning that users of my application only need to download one file. However, when publishing an .exe from a Forms application, I'm forced to include all of these .dll files independently:

Soluition Explorer

If you don't already have a publishing profile, follow the instructions to create one and choose the Folder target-type.

  • Choose Edit.

    Edit

  • In the Profile settings dialog, set the following options:

    • Set Deployment mode to Self-contained or Framework-dependent.
    • Set Target runtime to the platform you want to publish to. (Must be something other than Portable.)
    • Select Produce single file.

    Choose Save to save the settings and return to the Publish dialog.

    Profile Settings

  • Choose Publish to publish your app as a single file.

  • For more information, see Visual Studio Docs: Single file deployment and executable.


    Duplicate of Embedding DLLs in a compiled executable

    CodePudding user response:

    I don't think compile all files into one is a good idea. If you want to have single file for downloading, you can package them into a self-extract zip format (winRAR, winzip or 7zip). Good luck~~

    • Related