Host.CreateDefaultBuilder vs Host.CreateApplicationBuilder in .NET Platform Extension 7

It is documented a bit here and here. The general idea was to move away from calbacks and move to linear code for configuring everything Code samples from the link… Web var builder = WebApplication.CreateBuilder(); builder.Logging.AddConsole(); builder.Services.AddOptions<MyOptions>().BindConfiguration(“MyConfig”); builder.Services.AddHostedService<MyWorker>(); var app = builder.Build(); app.MapGet(“/”, () => “Hello World”); app.Run(); Non-Web var builder = Host.CreateApplicationBuilder(); builder.Logging.AddConsole(); builder.Services.AddOptions<MyOptions>().BindConfiguration(“MyConfig”); … Read more

Could not load file or assembly ‘System.Runtime, Version=7.0.0.0…’ – After installing .NET Core 7 ‘dotnet watch run’ not working

According to the Microsoft document, the SDK uses the latest installed version and this is an expected behavior: The .NET CLI must choose an SDK version for every dotnet command. It uses the latest SDK installed on the machine by default, even if the project targets an earlier version of the .NET runtime. So, it … Read more

Equivalent to UserSettings / ApplicationSettings in WPF for newer .NET versions

You can add the same old good settings file e.g. via the right click on the Properties -> Add -> New Item and search for the “Settings”. The file can be edited in the settings designer and used as in the .net framework projects before (ConfigurationManager, Settings.Default.Upgrade(), Settings.Default.Save, etc. works). Add also the app.config file … Read more