/// <summary> /// 创建 <see cref="WebApplicationBuilder"/> /// </summary> /// <param name="args"></param> /// <param name="startupStatusFile"></param> /// <returns></returns> public static WebApplicationBuilder CreateBuilder(string[] args, string startupStatusFile) { // 内容根目录 string contentRoot = GetContentRoot(); DirectoryInfo?endDir = GetEndDirInfo(); // 自定义配置文件 string customConfigJsonFile = GetCustomConfigJsonFile(contentRoot, endDir); // 参数指定配置文件 string argsConfigJsonFile = GetArgsConfigJsonFile(args); var builder = WebApplication.CreateBuilder(new WebApplicationOptions() { Args = args, ContentRootPath = contentRoot }); HostHelper.ConfigurationHostBuilder(builder.Host, startupStatusFile, contentRoot, customConfigJsonFile, args, argsConfigJsonFile, endDir); return(builder); }