June 14th, 2017

The week in .NET – On .NET with Mattias Karlsson on Cake, Topshelf

Bertrand Le Roy
Senior Software Engineer

Previous posts:

On .NET: Mattias Karlsson – Cake

During the Microsoft Build conference, we recorded interviews with some of the attendees. Mattias Karlsson is a core contributor on Cake, the cross-platform build automation system with a C# DSL.

Package of the week: Topshelf

Topshelf is a framework for hosting services written using .NET. The creation of services is simplified by allowing developers to create an easy to debug console application that can also be installed as a service.

public class TownCrier
{
    readonly Timer _timer;
    public TownCrier()
    {
        _timer = new Timer(1000) {AutoReset = true};
        _timer.Elapsed += (sender, eventArgs) =>
            Console.WriteLine($"It is {DateTime.Now} and all is well");
    }
    public void Start() { _timer.Start(); }
    public void Stop() { _timer.Stop(); }
}

public class Program
{
    public static void Main()
    {
        HostFactory.Run(x =>
        {
            x.Service<TownCrier>(s =>
            {
               s.ConstructUsing(name=> new TownCrier());
               s.WhenStarted(tc => tc.Start());
               s.WhenStopped(tc => tc.Stop());
            });
            x.RunAsLocalSystem();

            x.SetDescription("Sample Topshelf Host");
            x.SetDisplayName("TownCrier");
            x.SetServiceName("TownCrier");
        });
    }
}

Meetup of the week: The Dockering of .NET with Cecil Phillip in Miami, FL

The June meeting of dotNet Miami will have .NET expert and Away From The Keyboard host Cecil Phillip talking about marrying Docker and .NET. Cecil will review the basics of Docker and how we can add containers to our applications.

Thursday, June 15, 2017 6:30 PM in Miami, FL

.NET

ASP.NET

C#

F#

There is more content available this week in F# Weekly. If you want to see more F# awesomeness, please check it out!

VB

Xamarin

Azure

UWP

Data

Game development

And this is it for this week!

Contribute to the week in .NET

As always, this weekly post couldn’t exist without community contributions, and I’d like to thank all those who sent links and tips. The F# section is provided by Phillip Carter, the gaming section by Stacey Haffner, the Xamarin section by Dan Rigby, and the Azure and UWP section by Michael Crump.

You can participate too. Did you write a great blog post, or just read one? Do you want everyone to know about an amazing new contribution or a useful library? Did you make or play a great game built on .NET? We’d love to hear from you, and feature your contributions on future posts. Please add your posts, it takes only a second.

We pick the articles based on the following criteria: the posts must be about .NET, they must have been published this week, and they must be original contents. Publication in Week in .NET is not an endorsement from Microsoft or the authors of this post.

This week’s post (and future posts) also contains news I first read on The ASP.NET Community Standup, on Weekly Xamarin, on F# weekly, and on The Morning Brew.

Author

Bertrand Le Roy
Senior Software Engineer

Bertrand has been programming since he was ten. He was an early contributor to ASP.NET, co-founded the Orchard CMS project, and he was also on the team that built .NET Core. He currently works on the Xamarin team on improving the Forms developer experience in Visual Studio and Visual Studio for mac.

0 comments

Discussion are closed.