英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论