当前位置: 代码迷 >> 综合 >> dotnet 打包命令
  详细解决方案

dotnet 打包命令

热度:13   发布时间:2023-12-24 06:34:21.0

打包成单个文件
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

  相关解决方案