fix: Improve assembly loading with GAC fallback in MainForm.ps1
This commit is contained in:
parent
eb6c9adc6b
commit
03b58af4ea
11
MainForm.ps1
11
MainForm.ps1
@ -4,11 +4,18 @@ Import-Module Microsoft.Graph.Files
|
|||||||
|
|
||||||
# Load Open XML assembly
|
# Load Open XML assembly
|
||||||
try {
|
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 {
|
catch {
|
||||||
[System.Windows.Forms.MessageBox]::Show("Error loading DocumentFormat.OpenXml.dll. Make sure it is installed.")
|
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
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Import our components
|
# Import our components
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user