DevServerProgram.cs 623 B

12345678910111213141516171819202122232425262728293031323334
  1. // See https://aka.ms/new-console-template for more information
  2. using PCC.Common.AssemblyInject;
  3. using PCC.Common.Init;
  4. Console.WriteLine("Hello, World!");
  5. ConsoleApplication.Init();
  6. var builder = Host.CreateApplicationBuilder(args);
  7. builder.SetLogFormatForSimpleConsole(false);
  8. //依赖注入和启动停止
  9. builder.Services.AddAssemblyInject<Program>();
  10. var host = builder.Build();
  11. try
  12. {
  13. await host.RunAsync();
  14. }
  15. catch (Exception e)
  16. {
  17. Console.WriteLine(e);
  18. throw;
  19. }
  20. finally
  21. {
  22. #if DEBUG
  23. Console.WriteLine();
  24. Console.Write("Finished, press ENTER to exit...");
  25. Console.ReadLine();
  26. #endif
  27. }