A lightweight, open-source program updater for Windows applications built with .NET Framework 4.8. This updater provides a modern UI with progress tracking and supports automatic updates for multiple files with hash verification.
- Modern Windows Forms UI with progress tracking
- XML-based settings configuration
- JSON-based update configuration
- Secure file verification using SHA256 hashes
- Automatic backup of existing files
- Process management (stops running programs before update)
- Detailed logging with color-coded messages
- Cancellation support
- Error handling and rollback capabilities
- Windows 7 or later
- .NET Framework 4.8 or later
- (For Development) Visual Studio 2019+
- or .NET 8+ SDK for using dotnet build command
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/Program_updater_for_win.git
-
Open the solution in Visual Studio or your preferred IDE
-
Build the solution:
dotnet build --configuration Admin
dotnet build --configuration NonAdmin
- If you need to exe requires admin privileges, you need to build the project with the Admin configuration.
- like update program in C:\Program Files\YourApp\
- If you need to exe does not require admin privileges, you need to build the project with the NonAdmin configuration.
- like update program in C:\Users\YourName\AppData\Local\YourApp\
Create a settings.xml
file in the same directory as the executable to customize the updater's behavior:
<?xml version="1.0" encoding="utf-8" ?>
<Settings>
<UI>
<WindowTitle>Program Updater</WindowTitle>
<TitleText>Program Update in Progress</TitleText>
</UI>
<Configuration>
<ConfigurationFilePath>https://raw.githubusercontent.com/your-username/your-repo/main/update_config.json</ConfigurationFilePath>
</Configuration>
</Settings>
The settings.xml file allows you to:
- Customize the window title and update message
- Specify the update configuration file location (HTTP, HTTPS, FTP, or FTPS)
Create a configuration file (update_config.json) with your update details:
{
"files": [
{
"name": "MainApplication",
"isExecutable": true,
"currentPath": "C:\\Program Files\\YourApp\\app.exe",
"newPath": "C:\\Program Files\\YourApp\\app_new.exe",
"backupPath": "C:\\Program Files\\YourApp\\Backup\\app.exe",
"downloadUrl": "http://your-server.com/updates/app.exe",
"expectedHash": "SHA256_HASH_OF_NEW_FILE"
}
]
}
The configuration file can be hosted on HTTP, HTTPS, or FTP:
ftp://your-server.com/path/to/update_config.json
or
ftp://username:password@your-server.com/updates/app.exe
To get file hash from Windows PowerShell:
Get-FileHash -Path "C:\Program Files\YourApp\app.exe" -Algorithm SHA256
- Run the updater:
updater.exe
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with .NET Framework 4.8
- Uses Newtonsoft.Json for JSON parsing
- Inspired by the need for a lightweight, open-source program updater
This software is provided "as is" without warranty of any kind. Use at your own risk.