configurationcakebuild

Custom config in cake.config


Cake supports configuration in a cake.config file.

Can I read my own config key/values from that file?


Solution

  • Cake has a method to retrieve those values.

    Example:

    cake.config

    [MyCustomConfig]
    Foo=Bar
    

    build.cake

    Information(Context.Configuration.GetValue("MyCustomConfig_Foo"));   // Bar
    

    (Note the underscore "_" - it isn't documented, so I hope it's reliable.)