Raymond Raymond

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

event 2021-11-15 visibility 2,414 comment 0 insights toc
more_vert
insights Stats
toc Table of contents

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:

2021111575040-image.png

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

2021111575201-image.png

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:

2021111575401-image.png

This issue is resolved:

2021111575730-image.png

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts