Linux jenkins .net core build appends windows paths to file locations

44 views
Skip to first unread message

Hardtraxx

unread,
Oct 16, 2017, 12:59:42 PM10/16/17
to Jenkins Users

I'm trying to build my asp.net core application using Jenkins which is hosted with Tomcat8 on an Ubuntu 16.04 machine. The first build succeeds but when starting builds after that they fail (without changing any code) because Jenkins does something weird with the file locations.

The application is being made on a windows machine. After pushing to a git repository Jenkins pulls the source and starts a build.

This is the build script I'm using:


dotnet restore
dotnet build --output "<path to workspace>/build"
dotnet publish --output "<path to workspace>/publish"


As I said before, the first time this build succeeds and I can deploy my web application. The second time I try to build this is what happens:


+ dotnet restore
  Restore completed in 45.32 ms for /usr/share/tomcat8/.jenkins/workspace/Memiro/MemiroFrontend/Memiro.FrontEnd/Memiro.FrontEnd.csproj.
  Restore completed in 30.38 ms for /usr/share/tomcat8/.jenkins/workspace/Memiro/MemiroFrontend/Memiro.FrontEnd/Memiro.FrontEnd.csproj.
[MemiroFrontend] $ /bin/sh -xe /tmp/tomcat8-tomcat8-tmp/jenkins4348889529144999043.sh
+ dotnet build --output /var/www/dotnet-app/memiro-frontend/build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file '/usr/share/tomcat8/.jenkins/workspace/Memiro/MemiroFrontend/Memiro.FrontEnd/C:/Users/Hardtraxx/source/repos/MemiroFrontEnd/Memiro.FrontEnd/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/usr/share/tomcat8/.jenkins/workspace/Memiro/MemiroFrontend/Memiro.FrontEnd/Memiro.FrontEnd.csproj]
/usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file '/usr/share/tomcat8/.jenkins/workspace/Memiro/MemiroFrontend/Memiro.FrontEnd/C:/Users/Hardtraxx/source/repos/MemiroFrontEnd/Memiro.FrontEnd/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/usr/share/tomcat8/.jenkins/workspace/Memiro/MemiroFrontend/Memiro.FrontEnd/Memiro.FrontEnd.csproj]

Build FAILED.


For some reason the windows path to the files is appended to the ubuntu path.


Why is the windows path appended during the second build?


How do I solve this issue?

Hardtraxx

unread,
Oct 19, 2017, 1:34:05 PM10/19/17
to Jenkins Users
For future reference:

I solved the issue by passing the --runtime variable to the dotnet command in the build script.
For some reason this is required when building from Jenkins. Building from command line doesn't require using the --runtime variable.
Reply all
Reply to author
Forward
0 new messages