You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

发布.NET 8 Isolated版Azure Functions时同步配置运行时设置异常

解决Azure Functions从.NET5升级到.NET8隔离模式的发布配置问题
  • 指定完整的版本标识参数
    Azure Functions Core Tools的--dotnet-version参数对于隔离模式,需要传入完整的显示名称而非仅版本号。修改发布命令,将版本参数替换为.NET 8 Isolated:

    func azure functionapp publish ${{ parameters.funcAppName }} --no-build --dotnet-isolated --dotnet-version '.NET 8 Isolated'
    

    若要保留参数灵活性,可通过拼接字符串实现:

    func azure functionapp publish ${{ parameters.funcAppName }} --no-build --dotnet-isolated --dotnet-version '.NET ${{ parameters.dotnetVersion }} Isolated'
    
  • 手动设置函数应用配置项
    函数应用的.NET隔离模式版本对应配置项FUNCTIONS_WORKER_RUNTIME_VERSION,值应为dotnet-isolated:8.0。在发布后添加Azure CLI步骤设置该配置:

    az functionapp config appsettings set --name ${{ parameters.funcAppName }} --resource-group <你的资源组名称> --settings FUNCTIONS_WORKER_RUNTIME_VERSION=dotnet-isolated:8.0
    

    同时确保FUNCTIONS_WORKER_RUNTIME已设置为dotnet-isolated,若未设置可一并添加:

    az functionapp config appsettings set --name ${{ parameters.funcAppName }} --resource-group <你的资源组名称> --settings FUNCTIONS_WORKER_RUNTIME=dotnet-isolated FUNCTIONS_WORKER_RUNTIME_VERSION=dotnet-isolated:8.0
    
  • 更新Azure Functions Core Tools版本
    旧版CLI对.NET8隔离模式的参数支持存在缺陷,确保流水线中使用最新的v4版本CLI:

    • Windows环境:
      choco upgrade azure-functions-core-tools -y
      
    • Linux/macOS环境:
      npm install -g azure-functions-core-tools@4
      
  • 确认项目文件配置正确
    检查.csproj文件是否已明确指定隔离模式和.NET8版本,避免CLI识别错误:

    <PropertyGroup>
      <TargetFramework>net8.0</TargetFramework>
      <AzureFunctionsVersion>v4</AzureFunctionsVersion>
      <OutputType>Exe</OutputType>
      <FunctionsWorkerRuntime>dotnet-isolated</FunctionsWorkerRuntime>
    </PropertyGroup>
    
  • 跳过自动配置同步,手动管理配置
    若CLI自动同步配置持续出错,可添加--no-sync-settings参数跳过同步,之后手动设置必要配置:

    func azure functionapp publish ${{ parameters.funcAppName }} --no-build --dotnet-isolated --no-sync-settings
    

    再通过Azure CLI或PowerShell完成配置项的设置。

内容的提问来源于stack exchange,提问作者David MacNeil

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 08:04:59