GitHub Workflow with Build Including Class Library in Another Repository

huangapple go评论59阅读模式
英文:

GitHub Workflow with Build Including Class Library in Another Repository

问题

My .NET项目在本地成功构建,但无法在GitHub工作流中成功构建。解决方案包括一个存储库中的主项目和另一个存储库中的类库解决方案。

D:
└── Source
    └── Repos
        ├── SweetSpot
        │   └── SweetSpot
        │       └── SweetSpot.csproj
        └── SweetBackend
            └── SweetBackend.csproj

我收到的错误可能表明预计将类库的构建程序集包含在主项目中。我该如何解决这个问题?

英文:

My .NET project builds successfully locally, but I cannot get a successful build with GitHub workflow. The solution includes a main project in one repository and a class library solution in another repository.

D:
└── Source
    └── Repos
        ├── SweetSpot
        │   └── SweetSpot
        │       └── SweetSpot.csproj
        └── SweetBackend
            └── SweetBackend.csproj

I am getting errors that might indicate that built assemblies of the class library are expected to be included in the main project. How can I resolve this?

答案1

得分: 0

The difficultly is in understanding the directory structure GitHub uses when checking out the repositories. When the first directory is checked out, the path is changed to a directory inside the repository, then the next repository is placed inside that subdirectory.

This can be resolved by explicitly specifying the path with checkout as below.

To get clarity on what is occurring, add a step that will recursively output the contents of the directories after checkout as below.

jobs:
build:

runs-on: windows-2019

steps:
- name: Checkout SweetSpot
  uses: actions/checkout@v3
  with:
    path: ./SweetSpot

- name: Checkout SweetBackend
  uses: actions/checkout@v3
  with:
    repository: SweetTrading/SweetBackend
    ref: master
    token: ${{ secrets.ACCESSGITHUB_TOKEN }}
    path: ./SweetBackend

- name: Go to root directory
  run: cd ./

- name: Print directory structure
  working-directory: ./
  run: |
    echo "Directory structure:"
    ls -R
英文:

The difficultly is in understanding the directory structure GitHub uses when checking out the repositories. When the first directory is checked out, the path is changed to a directory inside the repository, then the next repository is placed inside that subdirectory.

This can be resolved by explicitly specifying the path with checkout as below.

To get clarity on what is occurring, add a step that will recursively output the contents of the directories after checkout as below.

jobs:
  build:

    runs-on: windows-2019

    steps:
    - name: Checkout SweetSpot
      uses: actions/checkout@v3
      with:
        path: ./SweetSpot

    - name: Checkout SweetBackend
      uses: actions/checkout@v3
      with:
        repository: SweetTrading/SweetBackend
        ref: master
        token: ${{ secrets.ACCESSGITHUB_TOKEN }}
        path: ./SweetBackend

    - name: Go to root directory
      run: cd ./

    - name: Print directory structure
      working-directory: ./
      run: |
        echo "Directory structure:"
        ls -R

huangapple
  • 本文由 发表于 2023年5月17日 23:34:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76273813.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定