Cannot find type: verify that the assembly containing this type is loaded. (Exception from HRESULT: 0x80131515)

Downloaded  HtmlAgilityPack.dll and loaded in Windows Powershell by running the following command

Add-Type -Path 'c:\Temp\PS\Net40\HtmlAgilityPack.dll'

Got the following error..

Add-Type : Could not load file or assembly ‘file:///C:\Temp\PS\Net40\HtmlAgilityPack.dll’ or one of its dependencies.
Operation is not supported. (Exception from HRESULT: 0x80131515)
At C:\Temp\PS\script.ps1:12 char:1
+ Add-Type -Path ‘c:\Temp\PS\Net40\HtmlAgilityPack.dll’
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand


HtmlAgilityPack.dll does not have any dependency for the .Net version I was on (use the command $psversiontable to get the .Net version used by Powershell)

It turned out that the file was blocked since it was downloaded from the internet. All I needed to do was to go to DLL’s properties and unblock it.

Exception from HRESULT: 0x80131515

Leave A Comment

Your email address will not be published.