Context
I am currently extending my companies shell script to build a .net solution on a build server. This solution consists out of multiple projects which some need to be build and published and some don't. These projects also vary in framework as some are written in .net Framework and the latest in .net Core. I have extended the shell script to the following:
msbuild.exe VirtualLaundry.sln
#Build .net framework projects
for project in Planbord Webportal WebportalCentraal RFIDReader
do
mkdir -pv publish/$project
msbuild.exe /t:"Build" /p:PipelineDependsOnBuild=False /p:UseWPP_CopyWebApplication=True /p:PrecompileBeforePublish=True /p:OutDir="$(cygpath -aw $project/bin)" /p:WebProjectOutputDir="$(cygpath -aw publish/$project)" $project/$project.csproj
rm -rf publish/$project/App_GlobalResources
rm -f $project.zip
mkdir -pv publish/$project/Config
cp -v source/$project/Web.config publish/$project/Config
echo "test" > publish/$project/versie.txt
if [[ ${shortversion:0:1} == [0-9] ]]
then
echo ${shortversion} > publish/$project/versie.txt
fi
(cd publish/$project && zip -r ../../$project.zip .)
done
# Build .net Core projects
echo Building .Net Core projects
for project in VL.API
do
echo $PWD
dotnet publish $project/$project.csproj -o publish
done
# Zip .net Core projects and remove old build output
for project in VL.API
do
echo $PWD
cd publish
zip -r ../VL.API.zip ./
cd ..
rm -r publish
done
Problem
When executing this shell it returns the following error:
+ echo Building .Net Core projects
Building .Net Core projects
+ for project in VL.API
+ echo /home/90105-091/build/p-019-220/release/source
/home/90105-091/build/p-019-220/release/source
+ dotnet publish VL.API/VL.API.csproj -o publish
Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
C:\Program Files\dotnet\sdk\3.1.403\NuGet.targets(128,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\home\90105-091\build\p-019-220\release\source\VL.API\VL.API.csproj]
C:\Program Files\dotnet\sdk\3.1.403\NuGet.targets(128,5): error : Value cannot be null. (Parameter 'path1') [C:\home\90105-091\build\p-019-220\release\source\VL.API\VL.API.csproj]
At first I thought that the Nuget API address (https://api.nuget.org/v3/index.json) was being blocked by the server which was the case but I already resolved that issue. I already searched for solutions elsewhere on stack overflow and the internet but those solutions do not work or do not apply to my problem.
Refereces:
- dotnet build command fails while restoring packages
- https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build?tabs=netcore2x#description
- Nuget connection attempt failed "Unable to load the service index for source"
I suspect there might be a different issue which the CLI does not show, but frankly I do not know for sure.
But my question is what (might) cause this issue?