3

I have cake file that I want to run in Windows and Ubuntu.

In Windows we need Cake.EntityFramework addin and in Ubuntu we do not need it.

So I want to write some platform specific addin like below

#if WINDOWS
#addin nuget:?package=Cake.EntityFramework&version=0.3.0
#endif

But I do not know how to do it?

2

1 Answer 1

1

Cake pre-processing for #addin, #tool, #load, #module, etc. does not support conditionals (#if). I'd suggest splitting your Cake files to multiple, one windows.cake, one linux.cake and one shared.cake. You can load shared logic using the #load directive.

3
  • Is it possible to add this feature in Cake, or it is not possible with current design of Cake? Oct 29, 2021 at 11:32
  • Not feasible to implement at this point. Also, last time I checked this wasn't either supported in vanilla C# scripting (csx). Oct 29, 2021 at 11:36
  • 1
    See github.com/cake-build/cake/issues/1860 for more info. Oct 29, 2021 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.