I have a repository product-config in gitlab that contains settings/configurations that are shared by the rest of the repositories.
So for e.g. I have a repository ec-firmware-service which has .productConfiguration.targets file which imports .target file of product-config repository like this
<Import Project="$(MSBuildThisFileDirectory)..\..\product-config\.msbuild\TransformApplicationConfig.targets" />
<Import Project="$(MSBuildThisFileDirectory)..\..\product-config\.msbuild\TaskConfigPreprocessor.targets" />
And product-config repository does have these target files but I am still getting this build error
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]
So basically it is this error
The imported project "C:\builds\engineering\myproject\swc\product-config\.msbuild\TransformApplicationConfig.targets" was not found.
Which is correct directory and path to the TransformApplicationConfig.targets file but it is somehow not able to pick it up.
The only reason that I can see is because it is in different repository.
Is there any way to target files in different repositories in gitlab or what could be the solution?
Update
I am targeting to build .net framework solution using this docker image in my .gitlab-ci.yml file mcr.microsoft.com/dotnet/framework/sdk
One solution that was suggested is to clone the repository to the current repository while building the solution so I tried to do that but the docker image I am using does not include git and so could not follow that solution.
So this is what I have written in my gitlab file
# 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
You can see the git clone line is commented. If I uncomment it, it starts giving error that git is not recognized.