【问题标题】:Publish multiple web.configs with dotnet publish使用 dotnet publish 发布多个 web.config
【发布时间】:2021-08-26 08:09:53
【问题描述】:

我正在使用 Blazor WASM,我将通过 web.config 服务器标头设置环境变量。但是,我希望能够通过 Azure DevOps IIS Web 部署任务在部署时转换 web.config。如何让dotnet publish 命令同时发布主web.config 和转换web.Release.config

【问题讨论】:

    标签: .net iis .net-core azure-devops blazor


    【解决方案1】:

    如果您只想通过 dotnet publish 转换 web.config 文件进行发布,您只需为“发布”设置 --configuration 选项。 例如,

    dotnet publish --configuration Release
    

    首先运行构建配置转换。

    此外,您还可以在构建配置转换后包含ProfileEnvironment自定义转换

    更多详情,您可以参考以下链接:

    Transform web.config

    ASP.NET Web Deployment using Visual Studio: Web.config File Transformations

    dotnet publish Command

    【讨论】:

      猜你喜欢
      • 2021-07-21
      • 2018-09-22
      • 2021-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-18
      • 1970-01-01
      相关资源
      最近更新 更多