Best practice for creating a Cake context in a non-Cake project #4126
-
There is a good amount of functionality in Cake that is useful outside of Cake. For example, the Cake.Incubator project has logic to parse solutions and project files which allows you to check if a project is a test project, what framework it is, traverse dependencies, etc. However, the function call to parse the project requires a Cake context. https://github.com/cake-contrib/Cake.Incubator/blob/develop/src/Cake.Incubator/Project/ProjectParserExtensions.cs#L568 Due to how it works it seems like the ICakeContext is required because of internal classes, etc. Is there an easier way to create an ICakeContext from a library that doesn't require instantiating ~15 classes? Or is there some helper function I missed to help instantiate all of those? Appreciate any guidance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Cjewett Take a look at Cake.Bridge by @devlead which has an example on how to use Cake directly from a C# Console app. You also might be interested in Cake.Bridge.DependencyInjection |
Beta Was this translation helpful? Give feedback.
@Cjewett Take a look at Cake.Bridge by @devlead which has an example on how to use Cake directly from a C# Console app.
You also might be interested in Cake.Bridge.DependencyInjection