The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Can’t debug a .NET project in Visual Studio Code on Windows? Answered in “.net – The library hostpolicy.dll was not found – Stack Overflow”

Posted by jpluimers on 2025/08/19

A while ago I bumped into the error [Wayback/Archive] .net – The library hostpolicy.dll was not found – Stack Overflow (thanks [Wayback/Archive] Nate Barbettini for asking) which prevented me to debug in Visual Studio Code, but none of the answers applied to my case, so I added this one:

I had this happen with .NET 6.0 where somehow the appname.runtimeconfig.json file was not being generated in the bin/Debug/net6.0/ directory.

The fix was modifying the .csproj file and include this fragment inside the  <PropertyGroup> element:

<GenerateRuntimeConfigDevFile>true</GenerateRuntimeConfigDevFile>

I found this solution while searching with https://www.google.com/search?q=net60+runtimeconfig.dev.json at Breaking change: runtimeconfig.dev.json file not generated – .NET | Microsoft Learn with the solution at MSBuild properties for Microsoft.NET.Sdk – .NET | Microsoft Learn:

GenerateRuntimeConfigDevFile

Starting with the .NET 6 SDK, the [Appname].runtimesettings.dev.json file is no longer generated by default at compile time. If you still want this file to be generated, set the GenerateRuntimeConfigDevFile property to true.

<PropertyGroup>
  <GenerateRuntimeConfigDevFile>true</GenerateRuntimeConfigDevFile>
</PropertyGroup>

After applying this to the .csproj file and re-building the project, debugging from Visual Studio Code worked fine including stopping at the breakpoints that I had set previously.

References

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.