fix: Improve assembly loading with GAC fallback in MainForm.ps1

This commit is contained in:
Bobby Abellana (aider) 2025-02-21 10:23:29 -08:00
parent eb6c9adc6b
commit 03b58af4ea

View File

@ -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