clowd / Clowd.Squirrel

Quick and easy installer and automatic updates for cross-platform dotnet applications
427 stars 39 forks source link

The process cannot access the file 'folder name' when trying to install/update via full installer #170

Closed luislhg closed 12 months ago

luislhg commented 1 year ago

Hello, I'm having a issue where the full installer is saying "The process cannot access the file" and I end up with a blank folder and I lose my old installation and the new one.

Error Squirrel Report

Result Squirrel app folders

Log The log contains the installation of version 8.0.1 which worked, and then the "attempt" to install 8.0.2 with the exceptions. Squirrel-bug-censored.log

Repro steps 1) Install 8.0.1 via Full Installer 2) Open 8.0.1 software 3) The software will try to download 8.0.2 Full Installer and run it (Process.Start("MyInstaller.8.0.2.exe")) 4) Exception/invalid install as reported above

Note¹: I'm not using the SDK to detect/update. My user has 8.0.1 installed and the software just downloads and runs the latest full installer (8.0.2 in this case). Note²: It used to work fine with .NET 4.8 and original Squirrel. Note³: In step 3, I already tried to run a .bat file and close the software. The bat waits for 5 seconds and then runs the installer, there was no process in use when the 8.0.2 installer opened, it still failed with the same exception/error.


Not sure why/how but the only situation where it works is if 1) 8.0.1 is opened and running but does not download/install 8.0.1 2) User manually downloads and runs 8.0.2 installer 3) 8.0.2 installer shut down the running app (forced, as the software did not log it was closing) and 8.0.2 is correctly installed.

This is unexpected though. If my software is properly closed and not running, why would a new version full installer fail to install?

KennyTK commented 1 year ago

Could you provide a code snippet of your .bat file? I want to better understand what you're doing

luislhg commented 1 year ago

Hello, sure. This is my bat file @echo off timeout /t 5 start "" "C:\Users\Admin\AppData\Local\Temp\MyInstaller.exe" I also did check that my softwares process no longer existed after 1-2sec.

Funny enough, if I (user) manually opens the new installer, even if with the software opened, everything works as expected.

luislhg commented 12 months ago

Found the issue, it's how Process.Start / ProcessStartInfo is implemented differently in .NET 6. In .NET 6 I now need to set the WorkingDirectory, otherwise it locks itself to the parent process folder by default. e.g.: WorkingDirectory = System.IO.Path.GetDirectoryName(processPath)

I'm closing the issue as this is not related to Squirrel.