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

使用GitHub Actions在Ubuntu构建Windows项目遇NU1102错误的解决方法

解决 NU1102: 找不到 Microsoft.NETCore.App.Runtime.win-x64 8.0.19 包的问题

可行解决方案:

1. 显式安装 Windows 目标运行时

在setup-dotnet步骤中添加指定运行时的配置,让Action自动安装win-x64对应的运行时包:

jobs:
  build:
    runs-on: ubuntu-latest

    - name: "⚙ Setup .NET"
      uses: actions/setup-dotnet@v4
      with:
          dotnet-version: '8.0.x'
          include-runtimes: win-x64

    - name: Restore dependencies
      run: dotnet restore --runtime win-x64

2. 锁定到已确认可用的.NET版本

若8.0.19版本的运行时包存在同步延迟或缺失问题,可暂时切换到前一个稳定版本:

- name: "⚙ Setup .NET"
  uses: actions/setup-dotnet@v4
  with:
      dotnet-version: '8.0.18'

3. 指定官方NuGet源进行还原

避免默认源同步问题,在还原步骤中明确指定官方源:

- name: Restore dependencies
  run: dotnet restore --source https://api.nuget.org/v3/index.json --runtime win-x64

4. 安装跨平台构建依赖(若需)

Ubuntu环境下构建Windows项目,可补充安装必要的跨平台支持组件:

- name: Install cross-build dependencies
  run: sudo apt-get update && sudo apt-get install -y wine64

内容的提问来源于stack exchange,提问作者Jeremy Thompson

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.12 13:42:04