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

visibility 16 comment 0 access_time 16d languageEnglish

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

Resolution

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

Tags