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

GitHub Actions推送NuGet包至GitHub Packages成功却报文件不存在错误

GitHub Actions推NuGet包成功但报错"File does not exist (true)"的解决

问题现象

执行GitHub Actions推送NuGet包到GitHub Packages时,包已成功上传,但流水线报错终止,命令输出如下:

Run dotnet nuget push ./package/*.nupkg --api-key *** --skip-duplicate --no-symbols true
Pushing WayStation_Models.1.0.0.nupkg to 'https://nuget.pkg.github.com/<Organization>'...
  PUT https://nuget.pkg.github.com/<Organization>/
  OK https://nuget.pkg.github.com/<Organization>/ 2209ms
Your package was pushed.
error: File does not exist (true).

对应的Workflow配置如下:

release:
    runs-on: ubuntu-latest    
    needs: build
    permissions: 
      packages: write
    if: github.ref == 'refs/heads/main' # only run job if on the main branch   
    
    steps:  
    #Push NuGet package to GitHub packages
    - name: Download nuget package artifact
      uses: actions/download-artifact@v3
      with:
        name: nugetPackage
        path: ./package
    - name: Setup .NET Core @ Latest
      uses: actions/setup-dotnet@v3
      with:
        dotnet-version: 7.0.x
        source-url: ${{ secrets.GHPACKAGESURL }}
      env:
        NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}   
    - name: Push package to GitHub packages 
      run: dotnet nuget push ./package/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols true

问题原因

该错误和私有仓库限制无关,是--no-symbols参数的使用方式错误。dotnet nuget push的--no-symbols是开关型参数,不需要附加true值。当你在参数后添加true时,CLI会将true识别为要推送的符号包文件名,而这个文件不存在,因此触发报错。

解决方案

修改推送命令,去掉--no-symbols后的true,直接使用参数本身:

dotnet nuget push ./package/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols

--no-symbols参数的作用是跳过推送符号包(.snupkg文件),只要参数存在就会生效,无需额外指定值。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 11:10:42