Jenkins Windows slave 上的 dotnet restore - 值不能为空
dotnet restore on Jenkins Windows slave - Value cannot be null
我有一个 .Net Core 应用程序,我正在尝试在我们的新 Jenkins 服务器上构建它,并且 运行 正在解决恢复 NuGet 包的问题。
我们新的构建基础设施包括一个在 CentOS 上的 Jenkins master 运行ning,这个特定的构建是 运行 在 Windows Server 2012 slave 上。两者之间的连接是通过 Cygwin 的 SSH。
这个构建在我们的旧 Jenkins 上工作得很好,它没有构建从属,运行s 在 Windows Server 2012 上。
我们正在使用 Jenkinsfile 将 NAnt 构建目标调用到 运行 构建。这是来自 NAnt 构建文件的恢复目标:
<target name="restore_nuget_packages" description="Restores the NuGet packages for the solution" >
<echo message="Restoring NuGet Packages" />
<property name="USERPROFILE" value="${environment::get-variable('USERPROFILE')}" />
<property name="HOME" value="${environment::get-variable('HOME')}" />
<echo message="USERPROFILE is ${USERPROFILE}" />
<echo message="HOME is ${HOME}" />
<exec program="${dotnet_path}" commandline="restore ${projectName}.sln"></exec>
</target>
当这个目标 运行 在我们的新服务器上时,我得到以下输出:
[NuGet Restore] restore_nuget_packages:
[NuGet Restore]
[NuGet Restore] [echo] Restoring NuGet Packages
[NuGet Restore] [echo] USERPROFILE is C:/Users/jenkinslvadmin
[NuGet Restore] [echo] HOME is C:\Users\jenkinslvadmin
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery\Microservice.NotificationDelivery.csproj...
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery\Microservice.NotificationDelivery.csproj...
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.Tests\Microservice.NotificationDelivery.Tests.csproj...
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.VisualStudio.Web.CodeGeneration.Tools'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.VisualStudio.Web.CodeGeneration.Tools'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NETCore.App'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NETCore.App'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='jose-jwt'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='jose-jwt'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='MailKit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='MailKit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper.Extensions.Microsoft.DependencyInjection'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper.Extensions.Microsoft.DependencyInjection'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='FluentValidation.AspNetCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] c:\program files\dotnet\sdk.1.301\NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] c:\program files\dotnet\sdk.1.301\NuGet.targets(114,5): error : Value cannot be null. [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] c:\program files\dotnet\sdk.1.301\NuGet.targets(114,5): error : Parameter name: path1 [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='FluentValidation.AspNetCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.CodeAnalysis.CSharp.Workspaces'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.CodeAnalysis.CSharp.Workspaces'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NET.Test.Sdk'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NET.Test.Sdk'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Moq'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Moq'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit3TestAdapter'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit3TestAdapter'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.Contracts'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.Contracts'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.ServiceBus'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.ServiceBus'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.State'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.State'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore]
[NuGet Restore] BUILD FAILED
我发现了其他类似的问题:
https://github.com/dotnet/core/issues/1037#issuecomment-338315953
https://blog.jongallant.com/2017/12/dotnet-value-cannot-be-null-parameter-name-path1/
https://github.com/dotnet/cli/issues/2385
他们让我相信这是一个问题,USERPROFILE 或 HOME 变量为空,分别是 Windows 和 Linux。 dotnet 将这些变量用于其 NuGet 包缓存,并且 Path.Combine() 方法在构建到 %USERPROFILE%.nuget\packages.
的路径时抛出错误
怀疑可能是master 运行ning Linux和slave 运行ning Windows的问题,我尝试在构建节点本身(我确保明确设置 USERPROFILE,即使它已经被定义),以及 Jenkins UI 中的构建节点环境变量配置。 las,我仍然遇到错误。我什至在目标输出的顶部包含了一些回声,如您所见,这些变量确实设置正确,但 dotnet restore 命令仍然抛出错误。
对我可能遗漏的内容有什么建议吗?
我在 dotnet
调用中添加了 -v diag
。虽然输出非常冗长,但它没有提供更多关于错误的信息(即哪个变量为空),但我确实得到了堆栈跟踪,一些额外的谷歌搜索让我找到了这个:
.NET Core dotnet restore failing on jenkins with System.ArgumentNullException
我将 LOCALAPPDATA 变量添加到 Jenkins UI 的从环境变量配置中,然后修复了它。
似乎 dotnet,更具体地说是 nuget cli,依赖于几个 Windows 内置环境变量来构建路径,但我无法在任何地方找到这些记录的列表。这是我们在 Jenkins slave 上定义的自定义变量的当前完整列表:
- 应用数据
- 本地应用程序数据
- 温度
- 用户个人资料
当然,这通常不是问题,因为这些应该始终存在于 Windows 系统中,但是在 Jenkins 从站上构建时,它会创建自己的自定义构建环境,您必须明确定义这些需要你自己的内置变量。
我有一个 .Net Core 应用程序,我正在尝试在我们的新 Jenkins 服务器上构建它,并且 运行 正在解决恢复 NuGet 包的问题。
我们新的构建基础设施包括一个在 CentOS 上的 Jenkins master 运行ning,这个特定的构建是 运行 在 Windows Server 2012 slave 上。两者之间的连接是通过 Cygwin 的 SSH。
这个构建在我们的旧 Jenkins 上工作得很好,它没有构建从属,运行s 在 Windows Server 2012 上。
我们正在使用 Jenkinsfile 将 NAnt 构建目标调用到 运行 构建。这是来自 NAnt 构建文件的恢复目标:
<target name="restore_nuget_packages" description="Restores the NuGet packages for the solution" >
<echo message="Restoring NuGet Packages" />
<property name="USERPROFILE" value="${environment::get-variable('USERPROFILE')}" />
<property name="HOME" value="${environment::get-variable('HOME')}" />
<echo message="USERPROFILE is ${USERPROFILE}" />
<echo message="HOME is ${HOME}" />
<exec program="${dotnet_path}" commandline="restore ${projectName}.sln"></exec>
</target>
当这个目标 运行 在我们的新服务器上时,我得到以下输出:
[NuGet Restore] restore_nuget_packages:
[NuGet Restore]
[NuGet Restore] [echo] Restoring NuGet Packages
[NuGet Restore] [echo] USERPROFILE is C:/Users/jenkinslvadmin
[NuGet Restore] [echo] HOME is C:\Users\jenkinslvadmin
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery\Microservice.NotificationDelivery.csproj...
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery\Microservice.NotificationDelivery.csproj...
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.Tests\Microservice.NotificationDelivery.Tests.csproj...
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.VisualStudio.Web.CodeGeneration.Tools'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.VisualStudio.Web.CodeGeneration.Tools'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NETCore.App'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NETCore.App'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='jose-jwt'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='jose-jwt'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='MailKit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='MailKit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper.Extensions.Microsoft.DependencyInjection'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper.Extensions.Microsoft.DependencyInjection'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='FluentValidation.AspNetCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] c:\program files\dotnet\sdk.1.301\NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] c:\program files\dotnet\sdk.1.301\NuGet.targets(114,5): error : Value cannot be null. [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] c:\program files\dotnet\sdk.1.301\NuGet.targets(114,5): error : Parameter name: path1 [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='FluentValidation.AspNetCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.CodeAnalysis.CSharp.Workspaces'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.CodeAnalysis.CSharp.Workspaces'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NET.Test.Sdk'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NET.Test.Sdk'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Moq'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Moq'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit3TestAdapter'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit3TestAdapter'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.Contracts'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.Contracts'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.ServiceBus'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.ServiceBus'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.State'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.State'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore]
[NuGet Restore] BUILD FAILED
我发现了其他类似的问题:
https://github.com/dotnet/core/issues/1037#issuecomment-338315953 https://blog.jongallant.com/2017/12/dotnet-value-cannot-be-null-parameter-name-path1/ https://github.com/dotnet/cli/issues/2385
他们让我相信这是一个问题,USERPROFILE 或 HOME 变量为空,分别是 Windows 和 Linux。 dotnet 将这些变量用于其 NuGet 包缓存,并且 Path.Combine() 方法在构建到 %USERPROFILE%.nuget\packages.
的路径时抛出错误怀疑可能是master 运行ning Linux和slave 运行ning Windows的问题,我尝试在构建节点本身(我确保明确设置 USERPROFILE,即使它已经被定义),以及 Jenkins UI 中的构建节点环境变量配置。 las,我仍然遇到错误。我什至在目标输出的顶部包含了一些回声,如您所见,这些变量确实设置正确,但 dotnet restore 命令仍然抛出错误。
对我可能遗漏的内容有什么建议吗?
我在 dotnet
调用中添加了 -v diag
。虽然输出非常冗长,但它没有提供更多关于错误的信息(即哪个变量为空),但我确实得到了堆栈跟踪,一些额外的谷歌搜索让我找到了这个:
.NET Core dotnet restore failing on jenkins with System.ArgumentNullException
我将 LOCALAPPDATA 变量添加到 Jenkins UI 的从环境变量配置中,然后修复了它。
似乎 dotnet,更具体地说是 nuget cli,依赖于几个 Windows 内置环境变量来构建路径,但我无法在任何地方找到这些记录的列表。这是我们在 Jenkins slave 上定义的自定义变量的当前完整列表:
- 应用数据
- 本地应用程序数据
- 温度
- 用户个人资料
当然,这通常不是问题,因为这些应该始终存在于 Windows 系统中,但是在 Jenkins 从站上构建时,它会创建自己的自定义构建环境,您必须明确定义这些需要你自己的内置变量。