.NET 6 Azure Functions Isolated: An error occurred while loading required library hostpolicy.dll

visibility 256 access_time 7 months ago languageEnglish timeline Stats
timeline Stats
Page index 1.31

Issue context

For .NET 6 Azure Functions with isolated worker as runtime, the following error occurred when debug in Visual Studio 2022:

Failed to load the dll from [C:\Users\***\AppData\Local\AzureFunctionsTools\Releases\4.10.1\cli_x64\hostpolicy.dll], HRESULT: 0x800700C1

An error occurred while loading required library hostpolicy.dll from [C:\Users\***\AppData\Local\AzureFunctionsTools\Releases\4.10.1\cli_x64\]
C:\Program Files (x86)\dotnet\dotnet.exe (process 1748) exited with code -2147450750.

Root cause

x86 version of dotnet is used as shown in the log while the library to load is 64:

C:\Program Files (x86)\dotnet\dotnet.exe


To fix this issue, we need to ensure 64 bit dotnet is used.

At the moment, x86 dotnet path is before the x64 version:

Move this x64 version above the x86 version as the following screenshot shows:

Click OK button to save the changes.

Restart Visual Studio 2022 or other IDEs/CLIs you are using to make the variable effective.

You can verify this by starting a new PowerShell window:

This issue is resolved:

copyright This page is subject to Site terms.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

More from Kontext
Get IP Address in ASP.NET Core 5
visibility 11,538
thumb_up 2
access_time 2 years ago
Connect to MySQL in .NET 5
visibility 2,771
thumb_up 1
access_time 2 years ago