打包成单个文件
Startup 构造函数中配置:
public Startup(IWebHostEnvironment env){
// 根据运行环境选择配置文件var configurationBuilder = new ConfigurationBuilder().SetBasePath(env.ContentRootPath).AddJsonFile("appsettings.json", optional: false, reloadOnChange: true).AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true).AddEnvironmentVariables();Configuration = configurationBuilder.Build();}
dotnet publish -r linux-x64 -c Release /p:PublishSingleFile=true