Writing custom C# tasks for FAKE
INFO
This documentation is for FAKE.exe before version 5 (or the non-netcore version). The documentation for FAKE 5 can be found here
"FAKE - F# Make" is intended to be an extensible build framework and therefor it should be as easy as possible to create custom tasks. This tutorial shows how to create a (very simple) custom task in C#.
Creating a custom task
Open Visual Studio and create a new C# class library called my MyCustomTask and create a class called RandomNumberTask:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: |
|
Using the custom task
Compile the project and put the generated assembly into the tools/FAKE path of your project. Now you can use your CustomTask in the build script:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: |
|
If you want to use FAKE's standard functionality (like globbing) within your CustomTask project, just reference FakeLib.dll and explore the FAKE namespace.