ExcelDna.ManagedHost.dll: Access Denied

305 views
Skip to first unread message

A Parmar

unread,
Jan 25, 2024, 5:15:20 AM1/25/24
to Excel-DNA
Hi, 

trying to get ExcelDna working on the latest version.

ExcelDna.Addin (1.8.0-alpha2)
NET 6.0
Excel 365

Attempt 1:
The file (ExcelDna.ManagedHost.dll) is saving to the Temp directory e.g. C:\Users\<UserName>\AppData\Local\Temp\ExcelDna.Host
But error: Could not load file assembly .... Access is denied.


Attempt 2:
I tried to add this property to the Project file, which bring the dll file (ExcelDna.ManagedHost.dll) into the bin\publish folder:
<ExcelDnaUnpack>true</ExcelDnaUnpack>

But error: Failure to find resource EXCELDNA.MANAGEDHOST



Any ideas?
ExcelDNAManagedHostError.PNG

A Parmar

unread,
Jan 25, 2024, 6:56:30 AM1/25/24
to Excel-DNA
further details on (Attempt 1) - see images with call stack / exceptions lines - in case its useful:

Error:

'EXCEL.EXE' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.26\System.Private.CoreLib.dll'.

Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll

Could not load file or assembly ' C:\Users\<UserName>\AppData\Local\Temp\ExcelDna.Host\ExcelDna.Host\<...>\ExcelDna.ManagedHost.dll'. Access is denied.

 

Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll

Could not load file or assembly 'ExcelDna.ManagedHost, Culture=neutral, PublicKeyToken=null'. Access is denied.

ExcelDNA-CallStack.jpg
ExcelDNA-Exception1.jpg
ExcelDNA-Exception2.jpg

A Parmar

unread,
Jan 25, 2024, 9:40:41 AM1/25/24
to Excel-DNA

I've managed to get this working using the following ExclusionPath - I think WindowsDefender was slowing down the access to the file (or similar):

 

Add-MpPreference -ExclusionPath ' C:\Users\<UserName>\AppData\Local\Temp'

johan beumee

unread,
Jan 25, 2024, 11:51:04 AM1/25/24
to exce...@googlegroups.com
You might have to be an administrator on Excel and Microsoft Visual Studio?

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/2e287178-940d-40c7-b7ce-464d08169b58n%40googlegroups.com.

A Parmar

unread,
Jan 25, 2024, 12:46:55 PM1/25/24
to Excel-DNA
Yes, I'm Admin - so I was able to add the Exclusion path I mentioned before in Windows Defender and it worked.

CFC GOTM

unread,
Jan 25, 2024, 7:07:18 PM1/25/24
to Excel-DNA
I had something similar happen... I got this when I tried to debug the DLL via starting it in Visual Studio, when I already had it open in a separate instance of Excel as an add-in.
Reply all
Reply to author
Forward
0 new messages