fix: Improve assembly loading with GAC fallback in MainForm.ps1
This commit is contained in:
parent
eb6c9adc6b
commit
03b58af4ea
13
MainForm.ps1
13
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user