0

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:

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?

1 Answers1

0

After a lot of fiddeling around I found that the error thrown in the script was caused by access rights to the NuGetScratch folder my Windows account did not have access to that folder. Since Nuget restores it packages from that lock folder it could not restore any packages, thus the build failed. After altering the access rights the error disappeared so my only guess is that that the "Value cannot be null. (Parameter 'path1') " error is a somewhat generic error that doesn't really show the under lying problem.