Search code examples
c#cross-platformcakebuild

How to addin specific package if cake running in windows


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?


Solution

  • 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.