dotnet restore fails. on jenkins slave.
Steps to reproduce
Build netcoreapp1.1 project.
Expected behavior
no error.
Actual behavior
Building netcoreapp1.1 project t on centos7.x64 on jenkins slave fails to restore packages. For some mysterious reason windows path appears in the log. The curious part I'm able able to build the same project manually logged through secure shell. Moreover, this build worked two weeks ago. Any tips would be appreciated.
00:00:01.869 + pwd
00:00:01.870 /var/jenkins/workspace/dev_v6api_devapp2_linux_build
00:00:01.870 + dotnet --info
00:00:01.981 .NET Command Line Tools (1.0.4)
00:00:01.982
00:00:01.983 Product Information:
00:00:01.983 Version: 1.0.4
00:00:01.983 Commit SHA-1 hash: af1e6684fd
00:00:01.983
00:00:01.983 Runtime Environment:
00:00:01.983 OS Name: centos
00:00:01.984 OS Version: 7
00:00:01.986 OS Platform: Linux
00:00:02.008 RID: centos.7-x64
00:00:02.008 Base Path: /opt/dotnet/sdk/1.0.4
00:00:02.008 + dotnet restore --verbosity d -r centos.7-x64 -s /opt/dotnet/sdk/1.0.4 --no-cache
00:00:02.583 /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api/v6api.csproj : error MSB4019: The imported project "/var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api/C:/Program Files/dotnet/sdk/1.0.4/Sdks/Microsoft.NET.Sdk.Web/Sdk/Sdk.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
00:00:02.590 /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api.tests/v6api.tests.csproj : error MSB4019: The imported project "/var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api.tests/C:/Program Files/dotnet/sdk/1.0.4/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
00:00:02.596 /opt/dotnet/sdk/1.0.4/NuGet.targets(97,5): warning : Unable to find a project to restore! [/var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api.sln]
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.4)
Product Information:
Version: 1.0.4
Commit SHA-1 hash: af1e6684fd
Runtime Environment:
OS Name: centos
OS Version: 7
OS Platform: Linux
RID: centos.7-x64
Base Path: /opt/dotnet/sdk/1.0.4
Can you share the .csproj file your are trying to build?
Here it is:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<AssemblyTitle>V6API</AssemblyTitle>
<VersionPrefix>6.0.0-1</VersionPrefix>
<TargetFramework>netcoreapp1.1</TargetFramework>
<NoWarn>$(NoWarn);1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>V6API</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>V6API</PackageId>
<RuntimeIdentifiers>win10-x64;centos.7-x64;win7-x64</RuntimeIdentifiers>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<None Update="wwwroot\**\*;V6API.xml">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\;" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="1.50.2" />
<PackageReference Include="DapperExtensions.DotnetCore" Version="1.0.1" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.2.1" />
<PackageReference Include="M2MqttDotnetCore" Version="1.0.6" />
<PackageReference Include="Swashbuckle" Version="6.0.0-beta902" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Npgsql" Version="3.2.5" />
<PackageReference Include="Serilog.Extensions.Logging" Version="1.4.0" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.Literate" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
</ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<ItemGroup>
<DocFile Include="bin\*\*\V6API.xml" />
</ItemGroup>
<Copy SourceFiles="@(DocFile)" DestinationFolder="$(PublishDir)" SkipUnchangedFiles="false" />
</Target>
</Project>
Managed to solve it by explicitly specifying project files. Since everything works manually, it might be jenkins issue, after all.
dotnet restore v6api/v6api.csproj -r centos.7-x64
dotnet restore v6api.tests/v6api.tests.csproj -r centos.7-x64
@rainersigwald Any ideas why restoring through the solution might be failing?
That Windows path mixed in there is very interesting indeed.
@evgeniylevakhin can you share out the msbuild.log produced by running dotnet msbuild -t:Restore -flp:v=diag <path/to/your/solution>?
Embarrassing, but I can't seem to reproduce this anymore...
I don't know if it was some weirdo copy/paste problem.
00:00:01.816 + pwd
00:00:01.816 /var/jenkins/workspace/dev_v6api_devapp2_linux_build
00:00:01.818 + dotnet --info
00:00:02.088 .NET Command Line Tools (1.0.4)
00:00:02.090
00:00:02.090 Product Information:
00:00:02.090 Version: 1.0.4
00:00:02.090 Commit SHA-1 hash: af1e6684fd
00:00:02.091
00:00:02.091 Runtime Environment:
00:00:02.091 OS Name: centos
00:00:02.091 OS Version: 7
00:00:02.091 OS Platform: Linux
00:00:02.171 RID: centos.7-x64
00:00:02.172 Base Path: /opt/dotnet/sdk/1.0.4
00:00:02.179 + dotnet restore
00:00:05.197 Restoring packages for /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api/v6api.csproj...
00:00:05.197 Restoring packages for /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api.tests/v6api.tests.csproj...
00:00:09.857 Generating MSBuild file /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api.tests/obj/v6api.tests.csproj.nuget.g.props.
00:00:09.860 Generating MSBuild file /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api.tests/obj/v6api.tests.csproj.nuget.g.targets.
00:00:09.861 Writing lock file to disk. Path: /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api.tests/obj/project.assets.json
00:00:09.915 Restore completed in 4.67 sec for /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api.tests/v6api.tests.csproj.
00:00:14.872 Generating MSBuild file /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api/obj/v6api.csproj.nuget.g.props.
00:00:14.872 Generating MSBuild file /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api/obj/v6api.csproj.nuget.g.targets.
00:00:14.873 Writing lock file to disk. Path: /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api/obj/project.assets.json
00:00:14.937 Restore completed in 9.68 sec for /var/jenkins/workspace/dev_v6api_devapp2_linux_build/v6api/v6api.csproj.
In that case. Closing the issue. Please, re-activate and provide the logs that @rainersigwald asked for above if you get a repro for this again.