Introducing ClickTwice - the build toolchain for ClickOnce

TL;DR; - I recently published an open-source ClickOnce publishing framework called ClickTwice. You can get it now for Cake, ScriptCs, .NET or as a WPF helper

A little history

This project was actually a side project of mine for several years, it has just taken me until now to open-source it and finally publish it! At the time I was publishing a ton of WPF tools for my organisation to use and I always cringed a little seeing my users hit the awful page that Visual Studio generated when it published ClickOnce apps. After seeing a user hit Install instead of Launch one too many times, I decided there had to be a better way and started working on what would become ClickTwice.

So what is it?

ClickTwice is a toolchain that both simplifies and supercharges deploying ClickOnce applications. Deploy your apps with ease, and all without opening Visual Studio! I call ClickTwice a toolchain, because it is not made to run on it's own, but instead uses other tools as a host to publish your app in. At release, we support publishing your apps from Cake build scripts, any ScriptCs script, or hosting in your own custom .NET tool.

This allows you to use your favourite build or scripting tool to publish ClickOnce apps the same way you can the rest of your code.

Enough talk, where's the code?

Remember I said that ClickTwice can simplify and supercharge? That's my favourite part of the toolchain: it can be as simple or as complex as you want. Let's use a Cake script as an example. Once you've installed the addin, here's how you publish an app:

//build.cake
Task("Publish")
.Does(() =>
{
    PublishApp(yourProjectPathHere).To("./artifacts/publish/");
});

Done, that's it! You've just published an app using MSBuild with all the defaults. Want to do the same thing with ScriptCs?

//build.csx
PublishApp(yourProjectPathHere).To("./artifacts/publish/");

Again, that's it! Just run your script, and your app is published? Want to get really serious with your Cake build? Time for the "supercharge" part of our earlier claim:

//build.cake
PublishApp(yourProjectPathHere)
        .WithHandler(new InstallPageHandler())
        .LogTo(new FileLogger())
        .SetConfiguration("Debug")
        .ForceRebuild()
        .SetBuildPlatform(MSBuildPlatform.x64)
        .ThrowOnHandlerFailure()
        .WithVersion("0.9.2.1")
        .To("./artifacts/publish/");

I know, that escalated quickly, but it makes a good demonstration of the capabilities you can quickly and easily add with ClickTwice. Remember, this is all without Visual Studio and basically just needs a copy of MSBuild (if you don't need C# 6 you don't even need that!), so is just as at home on a CI server as on your dev workstation.

What can I do?

ClickTwice is designed as a build pipeline. You can extend your build with "handlers" that can run at various stages of your build process to do anything. We ship with a number of these handlers built in to perform common tasks like producing install pages, generating HTML static content, and publishing app metadata. Handlers themselves are dead easy to build and you can do just about anything with them, so you can easily implement app-specific build steps or even publish a new handler for our community to use.

How do I get started?

That depends on your choice of host. You can find documentation for our Cake and ScriptCs hosts on GitHub, and self-hosting documentation is coming soon.

How do I contribute?

I built this for the community of ClickOnce users to build on, so I'd love to take advice, questions and contributions. Just raise an issue or a PR on the GitHub repo.

Summary

I'm intending on perhaps adding new features and handlers in the coming months, as well as improving documentation with tutorials, so keep your eyes peeled for more updates on ClickTwice coming soon!

If you have any suggestions, requests, feedback, questions or comments, let me know in the comments, on the GitHub repo, or on Twitter.

Comments

comments powered by Disqus