Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cake on .Net core #1751

Open
trondhindenes opened this issue Aug 15, 2017 · 21 comments

Comments

@trondhindenes
Copy link

commented Aug 15, 2017

According to the documentation, Cake can run on .Net core. However, when running the build.sh package for linux, it requires mono.
How can I run a cake script without relying on mono on Linux?

@patriksvensson

This comment has been minimized.

Copy link
Member

commented Aug 15, 2017

@trondhindenes You will need to install the Cake.CoreClr package instead of the Cake. We currently do not have any bootstrappers for Cake.CoreClr that doesn't use NuGet to fetch packages so you will need to download the packages by some other means.

I think @devlead have written scripts for this.

@devlead

This comment has been minimized.

Copy link
Member

commented Aug 15, 2017

Here's an example bootstrapper for running only on .NET Core
https://github.com/devlead/BitbucketPipelinesShield/blob/master/build.sh

@trondhindenes

This comment has been minimized.

Copy link
Author

commented Aug 15, 2017

Thanks!
I'm getting this: The specified framework 'Microsoft.NETCore.App', version '1.0.4' was not found, I guess it's caused by outdated references in the Cake.CoreCLR. Nuget.org doesnt list any dependencies for the package, so it's hard to see if the newest versions are updated either. It would be great if you could publish more metadata to nuget.

@devlead

This comment has been minimized.

Copy link
Member

commented Aug 15, 2017

Which version of the .NET CLI do you have installed? Package has no dependencies as everything but the .NET CLI is in the package.

@trondhindenes

This comment has been minimized.

Copy link
Author

commented Aug 15, 2017

The script which the bootstrap installer downloads is not compatible with my OS (Ubuntu 17) it seems, so I commented it out - hoping that I could use one of the installed .net core versions already on my computer instead - which didn't work. But no worries, I can install some older CoreFX runtimes/SDKs tomorrow and try again then. Will report back. I guess the script could be a made to check if a framework download is needed before it goes ahead and downloads it, but no biggie. I'll report back once I've looked more at this in the morning.

@devlead

This comment has been minimized.

Copy link
Member

commented Aug 15, 2017

The example supplied script downloads 0.19.3, latest version of Cake is 0.21.1 so you could try getting latest version if you haven't already.
Which version of the .NET CLI & SDK do you have installed? Cake currently compiled with .NET CLI 1.1.0 and SDK 1.0.4.

@trondhindenes

This comment has been minimized.

Copy link
Author

commented Aug 15, 2017

The specified framework 'Microsoft.NETCore.App', version '1.0.4' was not found.
  - Check application dependencies and target a framework version installed at:
      /usr/share/dotnet/shared/Microsoft.NETCore.App
  - The following versions are installed:
      1.1.2
      1.1.1

and

~/Documents/projects/cakecorefx  dotnet --version
1.0.4
@trondhindenes

This comment has been minimized.

Copy link
Author

commented Aug 15, 2017

I guess I'm mising the 1.1.0 .Net cli. Version numbers in .Net confuse me.

@dweggemans

This comment has been minimized.

Copy link

commented Aug 24, 2017

All I get so far after hours of struggling is "Failed to initialize CoreCLR, HRESULT: 0x80131500"

I'm on a Docker image with Debian Stretch (microsoft/aspnetcore-build:1.0-2.0`)
dotnet --version is working (version 2.0.0)
mono --version also (Mono JIT compiler version 4.6.2 (Debian 4.6.2.7+dfsg-1)

I'm using a modified build.sh script from @devlead (removed core cli install since it's in the docker image already).

I turns out it is because the Cake dll depends on libicu52. Manually installing it by running
wget http://ftp.de.debian.org/debian/pool/main/i/icu/libicu52_52.1-8+deb8u5_amd64.deb && dpkg -i libicu52_52.1-8+deb8u5_amd64.deb
solved it for me.

Would it be possible to get rid of this dependency?

@ErikSchierboom

This comment has been minimized.

Copy link
Contributor

commented Aug 31, 2017

I'm looking into this, to see what it takes to run Cake on .NET Core 2.0

@ghost

This comment has been minimized.

Copy link

commented Sep 7, 2017

An easier solution to this might be to create a "self-contained" deployment for Cake.CoreClr (https://docs.microsoft.com/en-us/dotnet/core/deploying/#self-contained-deployments-scd)

I've spent all morning trying to get Cake.CoreClr running in an environment where only the 2.0 SDK is installed (installing 1.0.4 locally for example) but just gave up. A self contained install might solve this.

@devlead

This comment has been minimized.

Copy link
Member

commented Sep 7, 2017

@elevate-andrewlock To do an OS specific publish and you get a cake binary that's framework independent you'll do something like

dotnet restore .\Cake\Cake.csproj -r ubuntu.16.04-x64
dotnet build .\Cake\Cake.csproj -r ubuntu.16.04-x64 -f netcoreapp1.0
dotnet publish .\Cake\Cake.csproj -r ubuntu.16.04-x64 -f netcoreapp1.0

which will give you an src/Cake/bin/Debug/netcoreapp1.0/ubuntu.16.04-x64/publish folder and there you'll find an native Cake binary with no need for "dotnet" core and should work and can be tested with
./Cake --version

One of the issues with this is that the result will be OS specific and potentially we would need to publish/package a version for each os, which might be where we end up int the feature, looking at the RID docs there would be a few to support (this is subject to change though)

Windows RIDs

  • Windows 7 / Windows Server 2008 R2
    • win7-x64
    • win7-x86
  • Windows 8 / Windows Server 2012
    • win8-x64
    • win8-x86
    • win8-arm
  • Windows 8.1 / Windows Server 2012 R2
    • win81-x64
    • win81-x86
    • win81-arm
  • Windows 10 / Windows Server 2016
    • win10-x64
    • win10-x86
    • win10-arm
    • win10-arm64

Linux RIDs

  • Red Hat Enterprise Linux
    • rhel.7-x64
  • Ubuntu
    • ubuntu.14.04-x64
    • ubuntu.14.10-x64
    • ubuntu.15.04-x64
    • ubuntu.15.10-x64
    • ubuntu.16.04-x64
    • ubuntu.16.10-x64
  • CentOS
    • centos.7-x64
  • Debian
    • debian.8-x64
  • Fedora
    • fedora.23-x64
    • fedora.24-x64
  • OpenSUSE
    • opensuse.13.2-x64
    • opensuse.42.1-x64
  • Oracle Linux
    • ol.7-x64
    • ol.7.0-x64
    • ol.7.1-x64
    • ol.7.2-x64
  • Currently supported Ubuntu derivatives
    • linuxmint.17-x64
    • linuxmint.17.1-x64
    • linuxmint.17.2-x64
    • linuxmint.17.3-x64
    • linuxmint.18-x64

OS X RIDs

  • osx.10.10-x64
  • osx.10.11-x64
  • osx.10.12-x64
@RehanSaeed

This comment has been minimized.

Copy link
Contributor

commented Sep 7, 2017

@devlead I believe it's also possible to publish all RID's into a single folder, so you end up with a sub-folder for each RID, containing platform specific files. You can also publish the earliest RID for a platform e.g. win7-x64 and omit later versions e.g. win10-x64 as the earlier version has all the files needed for all versions (Tested this with Windows but not Mac or Linux). In theory you end up one sub-folder for mac and Windows and then one for each linux distro. Not sure what the final file size would be.

@ErikSchierboom

This comment has been minimized.

Copy link
Contributor

commented Sep 7, 2017

I don't think we necessarily have to do that. The main problem now is that there is no .NET Core App 2.0 compatible version of Cake released. This should be a separate package besides the existing CoreClr one I think, or else we have to create some hierarchy in the Cake.CoreClr package.

While working on this, I had to update xUnit to the latest version (or else xUnit won't run on a machine with only .NET Core 2.0 installed), but I found a bug with xUnit: xunit/xunit#1443

@devlead

This comment has been minimized.

Copy link
Member

commented Sep 7, 2017

it's a shame one can't dotnet publish from a nuget package because Cake.dll could essentially be an .NET Standard 1.6 assembly and a netcore2.0 app "should" be able to reference that.

@ErikSchierboom

This comment has been minimized.

Copy link
Contributor

commented Sep 7, 2017

Yeah, it is all a bit dicey at the moment.

@luigiberrettini

This comment has been minimized.

leehmanQQ added a commit to leardev/DiabloSharp that referenced this issue Apr 12, 2019

@leehmanQQ

This comment has been minimized.

Copy link

commented Apr 27, 2019

As of now Cake Tool can be installed as global tool (see https://www.nuget.org/packages/Cake.Tool/) and the tool can be run via dotnet-cake. The tool will execute your cake script.

@ErikSchierboom

This comment has been minimized.

Copy link
Contributor

commented Apr 27, 2019

Yep, I've already used it and it is working like a charm!

@RehanSaeed

This comment has been minimized.

Copy link
Contributor

commented Apr 29, 2019

Does the cake tool use .NET Framework or .NET Core to execute .cake scripts?

@devlead

This comment has been minimized.

Copy link
Member

commented Apr 29, 2019

ATM checking nuget packages we provide

  • Cake.Tool is a .NET global tool, targeting/executing on .NET Core 2.1
  • Cake.CoreCLR is a .NET Core console targeting/executing on .NET Core 2.0
  • Cake is a .NET Framework console targeting/executing on .NET Framework 4.6.1/Mono
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.