Cake Build addin for managing Topshelf windows services
- Install
- Uninstall
- Start
- Stop
Cake.Topshelf is available as a nuget package from the package manager console:
Install-Package Cake.Topshelf
or directly in your build script via a cake addin directive:
#addin "Cake.Topshelf"
#addin "Cake.Topshelf"
Task("Install")
.Description("Installs a Topshelf service")
.Does(() =>
{
InstallTopshelf("C:/Services/example.exe", new TopshelfSettings()
{
Username = "Admin",
Password = "Password1",
Instance = "Example",
Autostart = true,
Delayed = true
});
});
Task("Install-Fluent")
.Description("Installs a Topshelf service using the fluent interface")
.Does(() =>
{
InstallTopshelf("C:/Services/example.exe", new TopshelfSettings()
.UseUsername("Admin")
.UsePassword("Password1")
.SetInstance("Example")
.SetAutostart()
.SetDelayed()
);
});
Task("Uninstall")
.Description("Uninstalls a Topshelf service")
.Does(() =>
{
UninstallTopshelf("C:/Services/example.exe");
});
Task("Start")
.Description("Starts a Topshelf service")
.Does(() =>
{
StartTopshelf("C:/Services/example.exe", "Instance Name");
});
Task("Stop")
.Description("Stops a Topshelf service")
.Does(() =>
{
StopTopshelf("C:/Services/example.exe", "Instance Name");
});
RunTarget("Install");
A complete Cake example can be found here.
- Please be aware of the breaking changes that occurred with the release of Cake v0.22.0, you will need to upgrade Cake in order to use Cake.Topshelf v0.2.0 or above.
If your looking to manage standard windows services or just looking for more related aliases its worth checking out Cake.Services.
If your looking for a way to trigger cake tasks based on windows events or at scheduled intervals then check out CakeBoss.
Copyright (c) 2015 - 2016 Sergio Silveira, Phillip Sharpe
Cake.Topshelf is provided as-is under the MIT license. For more information see LICENSE.
If this project helps you in anyway then please ⭐ the repository.