Creating installers in .net

I want to create an installer that simply dumps several files and folders in the location specified by the user. But the problem is that these files are required to be selected from a fixed source folder, and then the installer is built. In addition, these files may change at any time, and then again a new version from the installer is required created.

I want to do this in .Net using the installation and deployment project. I am not sure how to do this. Do I need to create another class library project using the installer?

In fact, the installer will have two options:

  • Just extract the files to the specified location
  • Embed files (HTML files) on the intranet sharepoint site.

Does anyone have any ideas?

+3
source share
4 answers

I created a Windows application with several forms that do everything I need. This Windows application behaves like an installation.

0
source

Consider a self-extracting ZIP file.

You can create one with DotNetZip . Requires .NET on the target machine. Unpacks files to the location specified by the user, and then, if necessary, launches the program you specified. This program may be one of the unzipped files, or it may be something else.

To create a self-extracting archive using DotNetZip, this is the code:

// create the SFX
using (ZipFile zip1 = new ZipFile())
{
    zip1.AddFile(filename1, "");       // extract to toplevel
    zip1.AddFile(filename2, "subdir"); // extract to subdir
    zip1.AddFile(filename3, "subdir");
    zip1.Comment = "This will be embedded into a self-extracting exe";
    zip1.AddEntry("Readme.txt", "This is Update XXX of product YYY");
    var sfxOptions = new SelfExtractorSaveOptions {
        Flavor = SelfExtractorFlavor.WinFormsApplication,
        Quiet = false,  // false == show a UI
        DefaultExtractDirectory = UnpackDirectory
    }
    zip1.SaveSelfExtractor(SfxFileToCreate, sfxOptions);
}

The user interface of the generated SFX is as follows:

alt text

SFX MSI, . .

+1
+1
source

Built in installation and deployment projects is a complete pain in my experience, so instead I use Advanced installer . Its cheap and easy to use. I think they also have a free version.

+1
source

Source: https://habr.com/ru/post/1736094/


All Articles