Based on that screenshots you have above, it looks like .NET Core has gone back to not creating it.
public class PositionOptions
{
public const string Position = "Position";
public string Title { get; set; } = String.Empty;
public string Name { get; set; } = String.Empty;
}
public class ConnectionStringOptions
{
public const string Position = "ConnectionString";
public string Production { get; set; } = String.Empty;
public string Development { get; set; } = String.Empty;
}
public static class AppConfigService
{
public static ConnectionStringOptions ConnectionStrings()
{
IConfigurationSection connectionsConfigurationSection = Configuration.Root().GetSection(ConnectionStringOptions.Position);
return connectionsConfigurationSection.Get<ConnectionStringOptions>();
}
public static PositionOptions GeneralSettings()
{
IConfigurationSection positionConfigurationSection = Configuration.Root().GetSection(PositionOptions.Position);
return positionConfigurationSection.Get<PositionOptions>();
}
public static string ApplicationKey()
{
return Configuration.Root()["AppKey"];
}
}
public class Configuration
{
public static IConfigurationRoot Root() =>
new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddXmlFile("app.config", optional: true, reloadOnChange: true)
.Build();
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<AppKey>XAS-1023</AppKey>
<Position>
<Title>Some title</Title>
<Name>My name</Name>
</Position>
<ConnectionString>
<Production>Data Source=.\SQLEXPRESS;Initial Catalog=NorthWind2024;Integrated Security=True;Encrypt=False</Production>
<Development>Data Source=.\SQLEXPRESS;Initial Catalog=NorthWind2023;Integrated Security=True;Encrypt=False</Development>
</ConnectionString>
</configuration>
ConnectionStringOptions connections = AppConfigService.ConnectionStrings();
PositionOptions generalSettings = AppConfigService.GeneralSettings();
var key = AppConfigService.ApplicationKey();