The .NET CLI project templating feature has been around for quite some time now but it's taken us a little while to get around to building a starter template for Cofoundry. Today we're releasing a .NET CLI project template for creating new Cofoundry websites.

Installing Cofoundry has always been a relatively simple process, but we can nethertheless streamline the experience by making some basic assumptions and including some default structures in a project template.

Firstly there are decisions to make about which packages to install. We've assumed that the majority of users (especially new users) will want to install the main Cofoundry.Web.Admin package, which includes the core, domain, web framework and admin panel. There's also a few essential plugin packages we include such as ImageSharp, ErrorLogging and SiteMap.

Secondly, even for experienced Cofoundry users it is useful to stub out the basic project structure including some example templates, blocks and custom entities, which can then be amended or discarded.

Lastly we have included some custom error page views, which are often essential but easy to forget to add.

Creating a project using the Cofoundry web template

To install the templates run the following command in your console:

dotnet new -i "Cofoundry.Templates::*"

Then install the template with the following command, substituting your project name for ExampleApp

dotnet new cofoundry-web -n ExampleApp

This will create your starter project. Here's what the project structure looks like:

The cofoundry-web project template structure

Enhancements & other templates

We've started with just the basic web template for now, although there's scope for us adding other templates. Given the breadth of projects you can create with Cofoundry it's difficult to predict which scenarios would benefit significantly from a project template, but do get in touch with us if you have any suggestions for new templates or enhancements to the web template.