From 03b58af4eaa96421bf2be6e33363d53c1d8acb3f Mon Sep 17 00:00:00 2001 From: "Bobby Abellana (aider)" Date: Fri, 21 Feb 2025 10:23:29 -0800 Subject: [PATCH] fix: Improve assembly loading with GAC fallback in MainForm.ps1 --- MainForm.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/MainForm.ps1 b/MainForm.ps1 index a6dcfe5..0275e18 100644 --- a/MainForm.ps1 +++ b/MainForm.ps1 @@ -4,11 +4,18 @@ Import-Module Microsoft.Graph.Files # Load Open XML assembly try { - Add-Type -Path "C:\Program Files\Microsoft Office\root\Office16\DocumentFormat.OpenXml.dll" + # Try loading from GAC + Add-Type -AssemblyName "DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" } catch { - [System.Windows.Forms.MessageBox]::Show("Error loading DocumentFormat.OpenXml.dll. Make sure it is installed.") - return + try { + # Try loading from a default path + Add-Type -Path "C:\Program Files\Microsoft Office\root\Office16\DocumentFormat.OpenXml.dll" + } + catch { + [System.Windows.Forms.MessageBox]::Show("Error loading DocumentFormat.OpenXml.dll. Make sure it is installed and the path is correct.") + return + } } # Import our components