cake-build / cake

:cake: Cake (C# Make) is a cross platform build automation system.
https://cakebuild.net
MIT License
3.9k stars 726 forks source link

Error while executing build.sh : Method 'Array.Empty' not found. #2340

Open eleite77 opened 5 years ago

eleite77 commented 5 years ago

What You Are Seeing?

System.MissingMethodException: Method 'Array.Empty' not found.

What is Expected?

Cake successfully installed in Ubuntu 18.04 GoCD agent Docker container

What version of Cake are you using?

0.30.0

Are you running on a 32 or 64 bit system?

64

What environment are you running on? Windows? Linux? Mac?

Linux / Ubuntu 18.04

Are you running on a CI Server? If so, which one?

GOCD / GoCD Agent : Docker container

How Did You Get This To Happen? (Steps to Reproduce)

When the pipeline executes the build.sh it fails.

Output Log

at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception, Boolean indent) <0x40d18b80 + 0x000af> in :0 at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception) <0x40d18b50 + 0x00013> in :0 at NuGet.Common.ExceptionUtilities.LogException (System.Exception ex, ILogger logger, Boolean logStackAsError) <0x40d18840 + 0x00133> in :0 at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x40cef860 + 0x008db> in :0 at NuGet.CommandLine.Program.Main (System.String[] args) <0x40cebd50 + 0x00037> in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method 'Array.Empty' not found. at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception, Boolean indent) <0x40d18b80 + 0x000af> in :0 at NuGet.Common.ExceptionUtilities.DisplayMessage (System.Exception exception) <0x40d18b50 + 0x00013> in :0 at NuGet.Common.ExceptionUtilities.LogException (System.Exception ex, ILogger logger, Boolean logStackAsError) <0x40d18840 + 0x00133> in :0 at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String[] args) <0x40cef860 + 0x008db> in :0 at NuGet.CommandLine.Program.Main (System.String[] args) <0x40cebd50 + 0x00037> in :0 An error occurred while installing Cake. thanks for your help

bjorkstromm commented 5 years ago

What version of Mono are you using?

eleite77 commented 5 years ago

thanks. Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4) I did a mix with the one found here https://github.com/devlead/BitbucketPipelinesShield/blob/master/build.sh and i added the support for nuget. it seems ok. but i don't know with the official build.sh don't work

eleite77 commented 5 years ago

the line #tool "nuget:?package=OctopusTools" don't work also... it seems to be not fully compatible with the linux version... :-(

Installing .NET CLI... dotnet-install: .NET SDK version 1.0.0-preview3-003223 is already installed. dotnet-install: Binaries of dotnet can be found in /godata/pipelines/gocd/.dotnet dotnet-install: Installation finished successfully. .NET Command Line Tools (1.0.0-preview3-003223)

Product Information: Version: 1.0.0-preview3-003223 Commit SHA-1 hash: 9d3b727392

Runtime Environment: OS Name: ubuntu OS Version: 16.04 OS Platform: Linux RID: ubuntu.16.04-x64 NuGet exited with 13 Could not find any relevant files for tool 'OctopusTools'. Perhaps you need an include parameter? Error: Failed to install tool 'OctopusTools'.

bjorkstromm commented 5 years ago

Minimum recommended Mono version is 4.4.2 (https://cakebuild.net/docs/overview/requirements), I’d recommend to update if you’d like to use .NET Framework version of Cake. However, since you are running on containers, Mono might be excessive and you want to use .NET Core version of Cake (Cake.CoreCLR). @devlead might have soe newer bootstrapper scripts for containers.

The build.sh you linked to is installing a very old version of dotnet sdk. I’d recommend to update that if you’d like to use Cake.CoreCLR. Additionally, Octopus tools have released a global dotnet tool, which you can use for running on with dotnet cli. Read more on how to install global dotnet tools in this blog post by @gep13.

eleite77 commented 5 years ago

@mholo65 thanks a lot for your reply i used the one which comes with apt-get install mono-complete (ubuntu 18.04). I will update my docker file to install it manually. 2 - does it mean i can use cake without mono while running on a docker container? thanks again

eleite77 commented 5 years ago

@mholo65 @devlead i am not able to install the 4.4.2 version all i get from https://www.mono-project.com/download/stable/#download-lin-ubuntu is 4.2.1 so still continuing to have the above issue

bjorkstromm commented 5 years ago

@eleite77 yes, you can use Cake without Mono if you use the Cake.CoreCLR package. Here’s an up-to-date bootstrapper for it https://github.com/csharpfritz/CoreWiki/blob/dev/build.sh

Please note that all Addins doesn’t target netstandard2.0, and might therefore not be supported. Same goes for some tools, etc.