I set up an ubuntu 16.04 machine with Jenkins, nodejs, and .net core 2.0, and then tried to have it build my .net core 2.0 web application. It failed with the following message(s):
16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Authorization". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Mvc.Abstractions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.IdentityModel.Tokens". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:26 /usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1987,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.IdentityModel.Tokens.Jwt". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/ForbiddenResult.cs(5,28): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(3,28): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Services/Impl/TokenManagementService.cs(10,14): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'System' (are you missing an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Services/Impl/TokenManagementService.cs(12,17): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/ForbiddenResult.cs(9,33): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/ForbiddenResult.cs(18,40): error CS0246: The type or namespace name 'ActionContext' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(8,51): error CS0246: The type or namespace name 'IActionFilter' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(33,33): error CS0246: The type or namespace name 'ActionExecutingContext' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(53,32): error CS0246: The type or namespace name 'ActionExecutedContext' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj] 16:32:27 Security/Decorators/GroupMemberAttribute.cs(58,24): error CS0246: The type or namespace name 'ActionExecutingContext' could not be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/MySolution Main App/MySolution.Common/MySolution.Common.csproj]
On my dev machine, I looked around and couldn't find those assemblies, but I'm definitely referencing them, so I'm guessing they're stashed in a common location somewhere.
What do I need to do to get all the referenced assemblies to be found by Jenkins and successfully build my project? All the documentation I've seen online seems to reference .net core 1.0 or 1.1 and it seems a lot of this stuff is different now.
My build steps are very simple (there's one). A script to do:
dotnet clean
dotnet restore
dotnet build