首页 > 解决方案 > GitHub Actions:找不到输入文件

问题描述

我正在尝试为我的解决方案恢复 nuget 包。为此,我在 GitHub Action 下面写了:

name: CI

on:
  push:
  pull_request:
      branches:
      - '*'
env:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
jobs:
  ci_build:
    name: Build
    runs-on: windows-latest
    steps:
    - name: NPM Authentication
      uses: actions/checkout@v1
    - name: Use Node.js
      uses: actions/setup-node@v1
    - name: Nuget Command
      uses: actions/checkout@master
    - uses: nuget/setup-nuget@v1
      with:
        nuget-api-key: ${{ secrets.NuGetAPIKey }}
    - run: nuget restore MyProject.sln
    - name: NuGet Tool Installer
      run: NuGetToolInstaller@0
    - name: NuGet Commad
      run: NuGetCommand@2
      env:
        restoreSolution: '$(solution)'
        selectOrConfig: 'config'
        nugetConfigPath: 'Build/NuGet.config'
    - name: VS Build
      run: VSBuild@1
      env:
        solution: '$(solution)'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
        msbuildArgs: /p:AuthenticateWithRegistry=false
    - name: VS Test
      run: VSTest@2
      env:
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
        testSelector: 'testAssemblies'
        testAssemblyVer2: '**\*test*.dll!**\*IntegrationTests.dll!**\*UiTests.dll!**\*TestAdapter.dll!**\obj\**'
    - name: Copy Files to - $(build.artifactstagingdirectory)
      run: CopyFiles@2
      env:
        content: |
            **\bin\Project*.zip
            **\bin\**\$(buildConfiguration)\*.msi
        targetFolder: $(build.artifactstagingdirectory)
        flattenFolders: true

以下是我得到的错误:

Run nuget restore Advanced.OpenLink365.sln

nuget restore MyProject.sln

shell: C:\Program Files\PowerShell\6\pwsh.EXE -command ". '{0}'"

env:

solution: **/*.sln

buildPlatform: Any CPU

buildConfiguration: Release

NUGET: C:\hostedtoolcache\windows\nuget.exe\5.4.0\x64/nuget.exe

Input file does not exist: MyProject.sln.

##[error]Process completed with exit code 1.

此外,我发现 "C:\Program Files\Powershell\6\pwsh.EXE" &C:\hostedtoolcache\windows\nuget.exe\5.4.0\x64/nuget.exe 没有可用的文件

此外,FYR - 文件夹结构如下:

  • 项目回购
    • .github
      • 工作流程
      • CI.yml
    • 项目
      • 我的项目.sln
      • ...其他项目文件

请让我知道我在这里错过了什么。

谢谢。

标签: nuget-package-restoregithub-actions

解决方案


将命令更改为:

- run: nuget restore Projects/MyProject.sln

推荐阅读