mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Enhances process launching on Windows by using ShellExecuteExW to start processes as the user, ensuring environment variables are correctly inherited. Relocates Update.exe and log files to writable user directories, addressing permission issues and improving application data isolation. Adds logging for process ID and root directory for improved debugging. Ensures existing environment variables are passed to child processes. Cleans up temporary files in the local app data directory during uninstallation.
VeloWpfSample
Prerequisites: vpk command line tool installed
This app demonstrates how to use WPF to provide a desktop UI, installer, and updates for Windows only.
You can run this sample by executing the build script with a version number: build.bat 1.0.0. Once built, you can install the app - build more updates, and then test updates and so forth. The sample app will check the local release dir for new update packages.
In your production apps, you should deploy your updates to some kind of update server instead.
WPF Implementation Notes
WPF generates a Program.Main(argv[]) method automatically for you, so it requires a couple of extra steps to get Velopack working with WPF.
- You need to create your own
Program.csclass, and add a staticMain()method. - In order for dotnet to execute this new Main() method instead of the default WPF one, you need to add the following to your .csproj:
<PropertyGroup> <StartupObject>YourNamespace.Program</StartupObject> </PropertyGroup> - You should run the
VelopackAppbuilder before starting WPF as usual.[STAThread] public static void Main(string[] args) { VelopackApp.Build().Run(); var application = new App(); application.InitializeComponent(); application.Run(); }