Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active January 10, 2022 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/affc766964fa27f6b59c8008481e2ae8 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/affc766964fa27f6b59c8008481e2ae8 to your computer and use it in GitHub Desktop.
Create Self-extracting Archives (SFX or SEA) in C# .NET
// Create FileStream to save SFX archive
using (FileStream zipFile = File.Open("Archives/archive.exe", FileMode.Create))
{
// Create a new archive
using (var archive = new Archive())
{
// Add files/folders to archive
archive.CreateEntry("SourceFile1.txt", "Archives/SourceFile1.txt");
// Create and set options for SFX archive
var sfxOptions = new SelfExtractorOptions()
{
ExtractorTitle = "Extractor",
CloseWindowOnExtraction = true,
};
// Create SFX archive
archive.Save(zipFile, new ArchiveSaveOptions() { SelfExtractorOptions = sfxOptions });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment