我product-config
在gitlab中有一个存储库,其中包含其余存储库共享的设置/配置。
因此,例如,我有一个存储库ec-firmware-service
,该存储库的文件会像这样.productConfiguration.targets
导入存储库.target
文件product-config
<Import Project="$(MSBuildThisFileDirectory)..\..\product-config\.msbuild\TransformApplicationConfig.targets" />
<Import Project="$(MSBuildThisFileDirectory)..\..\product-config\.msbuild\TaskConfigPreprocessor.targets" />
而且product-config
存储库确实具有这些目标文件,但是我仍然遇到此构建错误
C:\builds\engineering\myproject\swc\ec-firmware-service\Configuration\\.productConfiguration.targets(5,3):
error MSB4019: The imported project
"C:\builds\engineering\myproject\swc\product-config\\.msbuild\TransformApplicationConfig.targets"
was not found. Confirm that the expression in the Import declaration
"C:\builds\engineering\myproject\swc\ec-firmware-service\Configuration\\..\\..\product-config\\.msbuild\TransformApplicationConfig.targets"
is correct, and that the file exists on disk.
[C:\builds\engineering\myproject\swc\ec-firmware-service\src\EC.FirmwareService.WebApi\EC.FirmwareService.WebApi.csproj]
所以基本上是这个错误
The imported project "C:\builds\engineering\myproject\swc\product-config\.msbuild\TransformApplicationConfig.targets" was not found.
该目录是TransformApplicationConfig.targets
文件的正确目录和路径,但无法以某种方式将其拾取。
我能看到的唯一原因是因为它在不同的存储库中。
有什么办法可以将目标文件放在gitlab中的不同存储库中,或者有什么解决方案?
更新资料
我的目标是在.gitlab-ci.yml
文件中使用此docker映像构建.net框架解决方案mcr.microsoft.com/dotnet/framework/sdk
建议的一种解决方案是在构建解决方案时将存储库克隆到当前存储库,因此我尝试执行此操作,但是我使用的docker映像不包含该镜像git
,因此无法遵循该解决方案。
这就是我在gitlab文件中写的
# Build
Build:
stage: build
image: mcr.microsoft.com/dotnet/framework/sdk
before_script:
#- git
script:
- echo $URL
- cd src
#- git clone https://${productconfigdeployerusername}:${productconfigdeployerpassword}@gitlab.cpicloudservices.com/engineering/easitrax-connect/swc/product-config.git
- msbuild /t:restore
- msbuild EC.FirmwareService.sln /p:Configuration=Release
only:
- branches
tags:
- windows-runner
environment:
name: development
您可以看到该git clone
行已注释。如果我取消注释,它将开始发出git
无法识别的错误。
您可以尝试创建一个新映像并在那里安装git,但是我不知道如何在Windows中执行该操作。
相反,您可以添加一个单独的作业来克隆存储库,并将其导出为作业工件。然后,Windows作业可以使用此工件,从而消除了图像中对git的需要。
stages:
- pre-build
- build
# Build
Clone:
stage: pre-build
image: alpine/git
script:
- mkdir git
- cd git
- git clone https://${productconfigdeployerusername}:${productconfigdeployerpassword}@gitlab.cpicloudservices.com/engineering/easitrax-connect/swc/product-config.git
artifacts:
paths:
- src
expire_in: 1 day
needs: []
only:
- branches
Build:
stage: build
image: mcr.microsoft.com/dotnet/framework/sdk
script:
- echo $URL
- cd src
- msbuild /t:restore
- msbuild EC.FirmwareService.sln /p:Configuration=Release
only:
- branches
tags:
- windows-runner
environment:
name: development
needs: ["Clone"]
免责声明:我没有运行此代码,它可能包含错误。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句