WebApplication.CreateBuilderpart()
is only used for web/api applications like the name implies Host.CreateDefaultBuilder()
is used to build a generic host (without web services, middleware etc) which you can use to build anything other than webhost.
See for example;
https://learn.microsoft.com/en-us/dotnet/core/extensions/generic-host
Which has not changed.
Its true that it feels a bit awkward to build console apps and/or backgroundservices at the moment.
Related Contents:
- InvalidOperationException: Unable to resolve service for type ‘Microsoft.AspNetCore.Http.IHttpContextAccessor’
- Hide Console Window in C# Console Application
- .NET console application exit event
- How do I effectively design my application where most classes depend on ILogger?
- Why exactly isn’t MEF a DI/IoC container?
- Using ELMAH in a console application
- What is different between and purpose of MEF and Unity?
- Simple Injector vs Hiro vs Autofac [closed]
- .NET Core dependency injection -> Get all implementations of an interface
- How is a Scoped service instance handled in a .NET Core Console application?
- Should logging infrastructure be injected when using IoC/DI if logging facade is used?
- Which Dependency Injection Tool Should I Use? [closed]
- Visual Studio jump to next error shortcut?
- Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths – why?
- What does ‘useLegacyV2RuntimeActivationPolicy’ do in the .NET 4 config?
- “Items collection must be empty before using ItemsSource.”
- Comparing two collections for equality irrespective of the order of items in them
- Best practices/guidance for maintaining assembly version numbers
- The reference assemblies for framework “.NETFramework,Version=v4.6.2” were not found
- Login failed for user ‘DOMAIN\MACHINENAME$’
- String.Join method that ignores empty strings?
- System.BadImageFormatException: Could not load file or assembly (from installutil.exe)
- How did Microsoft create assemblies that have circular references?
- Remove unused references (!= “using”)
- What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout?
- How to use XPath with XElement or LINQ?
- Cannot find Assert.Fail and Assert.Pass or equivalent
- .net: System.Web.Mail vs System.Net.Mail
- Get currently focused element/control in a WPF window
- System.Diagnostics.Debug.WriteLine in production code
- Windows Forms’ CheckBox CheckedChanged vs. CheckStateChanged
- What is IL Weaving?
- How can one get an absolute or normalized file path in .NET?
- Why can .NET not have memory leaks?
- Visual Studio Can’t Target .NET Framework 4.8
- How to include XML documentation file in NuGet package built from a project file?
- What names do you find yourself prepending/appending to classes regularly? [closed]
- Do you have to deploy the .pdb file with compiling under release?
- Where’s result of System.Diagnostics.Trace.WriteLine?
- ‘Newtonsoft.Json’ already has a dependency defined for ‘Microsoft.CSharp’
- Best practices for signing .NET assemblies?
- Reasons for a 409/Conflict HTTP error when uploading a file to sharepoint using a .NET WebRequest?
- Make regular expression case insensitive in ASP.NET RegularExpressionValidator
- .Net: Running code when assembly is loaded
- Windows temporary files behaviour – are they deleted by the system?
- Is there a memory limit for a single .NET process
- Difference between EventLog.WriteEntry and EventLog.WriteEvent methods
- How can I get the assembly last modified date?
- What is the default buffer size for StreamWriter
- What is an object graph and how do I serialize one