Код: Выделить всё
var builder = WebApplication.CreateBuilder(args);
// ... Configure services, routes, etc.
app.Run();
+ public partial class Program { }
Мне не нравится компилятор Voodoo, поэтому я бы предпочел, чтобы он был явным и классическим способом:
Код: Выделить всё
public class Program
{
public static async Task Main(params string[] args)
{
// ...
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
// ... ???
}
}
inside >, как один из его внутренних методов:
Код: Выделить всё
/// The default implementation of this method looks for a public static IHostBuilder CreateHostBuilder(string[] args)
/// method defined on the entry point of the assembly of and invokes it passing an empty string
/// array as arguments.
Не могли бы вы показать мне общий и явный шаблон, который будет работать для веб -приложений? Я использую пакет Microsoft.aspnetcore.openapi с .net 8.
Подробнее здесь: https://stackoverflow.com/questions/796 ... cs-with-ma