Skip to content

SharpeRAD/Cake.Topshelf

 
 

Repository files navigation

Cake.Topshelf

Cake Build addin for managing Topshelf windows services

Build status

cakebuild.net

Join the chat at https://gitter.im/cake-build/cake

Table of contents

  1. Implemented functionality
  2. Referencing
  3. Usage
  4. Example
  5. Plays well with
  6. License
  7. Share the love

Implemented functionality

  • Install
  • Uninstall
  • Start
  • Stop

Referencing

NuGet Version NuGet Downloads

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"

Usage

#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");

Example

A complete Cake example can be found here.

TroubleShooting

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

Plays well with

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.

License

Copyright (c) 2015 - 2016 Sergio Silveira, Phillip Sharpe

Cake.Topshelf is provided as-is under the MIT license. For more information see LICENSE.

Share the love

If this project helps you in anyway then please ⭐ the repository.

About

Cake build addin for managing Topshelf based windows services.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 86.8%
  • PowerShell 12.7%
  • Batchfile 0.5%