Rider/Azure: hostpolicy.dll not found

When running/debugging an Azure Functions project locally, I get the error: 

C:\Users\wsieburgh\AppData\Local\JetBrains\Toolbox\apps\Rider\ch-0\202.7660.16\plugins\dpa\DotFiles\JetBrains.DPA.Runner.exe --handle=5724 --backend-pid=1504 --detach-event-name=dpa.detach.5724 "C:\Program Files\dotnet\dotnet.exe" Y:/RiderProjects/invoicesintegration/source/Functions/bin/Debug/netcoreapp3.1/bin/Invoicing.Functions.dll A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'Y:\RiderProjects\invoicesintegration\source\Functions\bin\Debug\netcoreapp3.1\bin\ '.

 

This was when running Rider on a Windows 10 machine.

On that same machine, the same project runs find in Visual Studio.

 

 

0
13 comments

Hello Wouter,

Does it work if you try to run it with dotnet run or somehow else outside of Rider? Similar issue was discussed in the following thread, and seems to be related to entry point issue. 

0

Was this ever solved? I have the same issue and I cannot find anything online. My Azure function App runs ok in Visual Studio but gets this error when I use rider. 

 

0

I have the same issue and can't figure out how to resolve it.

On Visual Studio it works fine even though I do not have the runtimeconfig.json file. In dotnet cli it runs also. This is the error in Rider:

The library 'hostpolicy.dll' required to execute the application was not found in '{path}\bin\Debug\net6.0\'.
Failed to run as a self-contained app.
  - The application was run as a self-contained app because '{path}\{projectName}Function.runtimeconfig.json' was not found.
  - If this should be a framework-dependent app, add the runtimeconfig.json file and specify the appropriate framework.

0

I tried to reproduce it with template projects, but have not faced such an issue. Would it be possible to share a sample project using which I could try again? You can send it with a new issue on our tracker. Thank you in advance!

0

I had the same issue because Rider was configured to launch the project using ".Net Launch Settings Profile", when I switched it to "Azure Function host" the project started properly.

5

I also get this issue, it's fine with some projects, but not for other. I ended up upgrading Rider to the latest version. the problem is gone. Not sure if something wrong in old Rider version is cleared or the new version fixed the issue.

0

hey has this been resolved?

0

Kshawish25, do you face this issue now? Could you please then clarify the details: Rider version, OS, and exact error message?

0

I just recently removed VS, VS Installer, MS MS Build Tools and ran into same issue.

I removed Rider, reinstalled it and then re-installed Core 6 SDK, maybe I only needed the second step but since Rider was defaulting to settings that require VS I decided a fresh install would help clear that up instead of trying to find all of the possible settings that might be wrong. Seems to have worked.

0

I am facing this issue in Rider when trying to run a Azure function project that was originally created in Visual Studio. It runs perfectly fine in Visual Studio and using the Azure Functions Core Tools cli (func start).

I have updated Rider to the latest version (2023.1) on my Windows 10 (Version 22H2). The error message is:

A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in '{path}\bin\Debug\net6.0\'.
Failed to run as a self-contained app.
- The application was run as a self-contained app because '{path}\bin\Debug\net6.0\{projectName}.runtimeconfig.json' was not found.
- If this should be a framework-dependent app, add the '{path}\bin\Debug\net6.0\{projectName}.runtimeconfig.json' file and specify the appropriate framework.
0

Hello Lena Osterhus,

do you have Azure Toolkit for Rider plugin installed and enabled? Did you select the suitable run configuration, provided by this plugin?

0

Hi Ivan, I now see that I was using the config from launchSettings.json - not the Azure Toolkit plugin. Using the Azure run config works.

Is there any way to get the launchSettings.json environment variables and other config settings into the the run config from Azure Toolkit, to avoid adding it manually?

0

Hello Lena Osterhus,

Thanks for the good suggestions. I have submitted a new feature request to our tracker. Feel free to upvote it and click Watch to subscribe for future status updates.

0

Please sign in to leave a comment.