Skip to content

Development Instructions

To run on Windows 7 SP1 and later versions without installing any runtime environment, and to facilitate user interface (UI) design, the development is conducted using the .Net Framework 4.5.2 environment. If using Microsoft Visual Studio 2022 and later versions, the .Net Framework 4.5.2 development package needs to be installed.

Build from source

The Release build is constructed from source code by embedding EasyInstall.Core.dll into Setup.exe through Costura.Fody, resulting in a single file output. The Debug build does not embed, and requires the DLL to be in the same directory.

CMD
# Clone repository
git clone https://github.com/IceElves/EasyInstall.git

# Open EasyInstall.sln with Visual Studio 2019 or a later version
# Select the Release configuration to generate the solution

Project structure

ProjectExplanation
EasyInstallConsole program for packaging and installing packages via command
EasyInstall.BuilderAn installation and build configuration program used for UI configuration and application packaging
EasyInstall.CoreCore library, including core functions such as packaging and unpacking
EasyInstall.SetupSetup program, parses configuration files for installation and uninstallation

Package format

The installation package generated by EasyInstall is a standard Windows PE executable file, with compressed data and configuration appended at the end of the EXE in an Overlay manner. The Windows loader only processes the PE header and ignores the appended data at the end, so this EXE can run normally.

SetupCompressed DataJSON ConfigurationJSON Length (4 bytes)Compressed Data Length (8 bytes)Modulus (8 bytes)
Standard PE executable file[1-byte compression type] + compressed file packageUTF-8 plaintext, containing all installation parametersint32int64ASCII "EASYINST"

The uninstaller format is the same, but the compressed data length is 0, retaining only the JSON configuration.

Icon Processing

The EXE icon is written through the Win32 Resource Update API:

csharp
BeginUpdateResource(exePath)
UpdateResource(RT_ICON, iconData × N)
UpdateResource(RT_GROUP_ICON, grpData)
EndUpdateResource()

ImageHelper is responsible for converting any image format (ICO/PNG/JPG/GIF/BMP) into valid ICO bytes:

csharp
ICO → Direct Use
PNG → PngToIco() (packaged into a single-image ICO)
Other → WPF BitmapImage decoding → PngBitmapEncoder re-encoding to PNG → PngToIco()

The built-in default icons (Install.png, Uninstall.png) are embedded in EasyInstall.Core.dll as WPF resources and then converted into ICOs after being read by ResourceReader.

Compressed data format

The compressed data, after decompression, is a self-describing file package with the following format:

[Number of 4-byte entries N] [4-byte path length] [Path UTF-8] [8-byte file size] [File content] × N The path is a relative path; during decompression, the target directory is directly concatenated to restore the file tree.

Supported compression algorithms

AlgorithmEnumerated Values ​​Characteristics
LZMA0x03Default, highest compression ratio, based on 7-zip SDK
GZip0x01Built-in .NET, balancing speed and compression ratio
Deflate0x02Built-in .NET, same compression ratio as GZip, 18 bytes less overhead
Store0x00Uncompressed, suitable for compressed resources

The compression type byte is stored in the first byte of the compressed data and is automatically identified during decompression, so there is no need to record it repeatedly in the configuration.

Registry integration

ItemHKLMHKCU
Full NameHKEY_LOCAL_MACHINEHKEY_CURRENT_USER
Scope of actionEntire computer (all users)Current user
Requires Administrator✅ Yes❌ No
Common UsageInstall software (system level)User configuration, auto-start

Standard Windows uninstallation registry entries:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{RegistryKey}
  DisplayName      = AppName
  DisplayVersion   = AppVersion
  DisplayIcon      = installDir\MainExecutable
  InstallLocation  = installDir
  Publisher        = Company
  UninstallString  = "uninstall.exe" /uninstall
  URLInfoAbout     = Website

Automatically start when powered on

\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\{{RegistryKey:AppName.exe}}

Packaging process

1. Copy the Setup.exe template to the output path.
2. Replace the EXE icon (Win32 BeginUpdateResource API)
3. Open the output EXE with FileMode.Append
4. Record the current position dataStartPos
5. Streaming compression, directly writing to the EXE (EntryFeedStream → Compressor → FileStream)
6. dataLen = current position - dataStartPos
7. Append JSON + jsonLen + dataLen + Magic

Multilingual support

Language resources are stored in EasyInstall.Core as WPF ResourceDictionary (XAML), and currently include Simplified Chinese (zh-CN.xaml) and English (en-US.xaml).

Language selection logic:

  • If the Language field is empty, it reads CultureInfo.CurrentUICulture; if it starts with zh, it's Chinese; otherwise, it's English.
  • Language = "zh-CN" → Force Chinese
  • Language = "en-US" → Force English

The language switching is achieved by replacing the dictionary in Application.Resources.MergedDictionaries, which is done before the main window is displayed.

CI/CD Integration Example

YML
# GitHub Actions Example
- name: Build installer
  run: |
    EasyInstall.exe app.json \
      --setup EasyInstall.Setup.exe \
      --output dist/MyApp_${{ github.ref_name }}_install.exe

Beijing BingYun Information Technology Co., Ltd.