diff --git a/AutoTrackR2/UpdatePage.xaml.cs b/AutoTrackR2/UpdatePage.xaml.cs index d80e87a..77a486b 100644 --- a/AutoTrackR2/UpdatePage.xaml.cs +++ b/AutoTrackR2/UpdatePage.xaml.cs @@ -160,10 +160,16 @@ namespace AutoTrackR2 private async Task<string> DownloadInstallerToDownloads(string url) { - // Get the path to the user's Downloads folder - string downloadsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Downloads"; + // Get the path to the user's Downloads folder (this works for OneDrive and other cloud storage setups) + string downloadsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"); string installerPath = Path.Combine(downloadsFolder, "AutoTrackR2_Setup.msi"); + // Ensure the downloads folder exists + if (!Directory.Exists(downloadsFolder)) + { + throw new Exception($"Downloads folder not found at: {downloadsFolder}"); + } + using var client = new HttpClient(); var response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); @@ -179,8 +185,17 @@ namespace AutoTrackR2 { try { - // Start the installer manually (this will let the user run it) - System.Diagnostics.Process.Start(installerPath); + // Prepare the command to run the .msi installer using msiexec + var processStartInfo = new System.Diagnostics.ProcessStartInfo + { + FileName = "msiexec", + Arguments = $"/i \"{installerPath}\" /norestart", // Silent install with no restart + UseShellExecute = true, // Ensures that the process runs in the background + CreateNoWindow = true // Hides the command prompt window + }; + + // Start the process (this will run the installer) + System.Diagnostics.Process.Start(processStartInfo); } catch (Exception ex) { diff --git a/AutoTrackR2_Setup/AutoTrackR2_Setup.vdproj b/AutoTrackR2_Setup/AutoTrackR2_Setup.vdproj index 30457e4..6becfd0 100644 --- a/AutoTrackR2_Setup/AutoTrackR2_Setup.vdproj +++ b/AutoTrackR2_Setup/AutoTrackR2_Setup.vdproj @@ -198,8 +198,8 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:AutoTrackR2_Setup" - "ProductCode" = "8:{F79114DA-3386-4C48-8836-A39014EFC706}" - "PackageCode" = "8:{AE03249A-7FA7-432F-A8D6-D6B34490F51F}" + "ProductCode" = "8:{B4E6C891-C68D-466A-A97A-D4B3790DEEC3}" + "PackageCode" = "8:{BB4766E4-3735-42A8-8486-1EABBE42C442}" "UpgradeCode" = "8:{0B78A147-D0DE-4F72-8906-A62611787CA7}" "AspNetVersion" = "8:" "RestartWWWService" = "11:FALSE"