ConfigurationManager not available in .net 5 class library / console application

Dave Gray 586 Reputation points
2022-05-24T07:19:31.78+00:00

Hello

My solution in Visual Studio 2022 comprises a class library and a console application. I would like to use
ConfigurationManager.AppSettings from the System.Configuration namespace, however it is not available.

This is targetting ,net 5 which if I uderstand correctly is not a .net core app.

Maybe I need to recreate as a core app?

Is targeting the app.config for settings and connection strings not the best way of developing in VS2022?

Thanks

204908-image.png

204985-image.png

205014-image.png

Developer technologies | .NET | .NET Runtime
0 comments No comments
{count} votes

Answer accepted by question author
  1. Viorel 125.7K Reputation points
    2022-05-24T08:09:47.447+00:00

    Try installing a NuGet package: "System.Configuration.ConfigurationManager".

    By the way, I think that .NET 5 is "Core" too, and you can re-create a more modern project using .NET 6.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.