---
title: "The dotnet new template"
url: https://recursiveai.org/oneapp/docs/templates/
description: "The markup compiler and the build step that makes each .html file and its .css neighbour a component template come with RecursiveAI.OneUI, which the two…"
version: "1.0.0"
source: https://github.com/recursive-ai-oss/oneapp-csharp/blob/64b0f3162f8c1b7bb766ceae32357442feaa5960/docs/templates.md
---

# The `dotnet new` template

```
dotnet new install RecursiveAI.OneApp.Templates
dotnet new oneapp -n MyApp
cd MyApp
dotnet tool restore        # the oneapp tool, from .config/dotnet-tools.json
dotnet run                 # the window
```

## What you get

| File | |
|---|---|
| `MyApp.csproj` | NativeAOT on, warnings as errors, the app's identity (`OneAppId`, `OneAppName`, `OneAppVersion`, `OneAppIcon`, see [packaging](https://recursiveai.org/oneapp/docs/packaging/)). References `RecursiveAI.OneApp` and `RecursiveAI.OneApp.Kit` and nothing else. |
| `Program.cs` | Creates the app host with the root component and runs it. `--headless` runs without a window or GPU, for driving through the harness. |
| `MainPage.html`, `.css`, `.cs` | One component built from the kit: a card with a text field and a counter button. Every binding is checked when the project builds. |
| `icon.png` | The launcher icon; replace it. |
| `.config/dotnet-tools.json` | The `oneapp` tool, so a clone builds and drives the app with `dotnet oneapp ...`. |

The markup compiler and the build step that makes each `.html` file and its `.css` neighbour a component template come with `RecursiveAI.OneUI`, which the two packages bring in.

## Options

| Option | Default | |
|---|---|---|
| `-n`, `--name` | `MyApp` | Project, namespace and window title. |
| `--appId` | `dev.example.myapp` | Application id: the desktop entry name on Linux, the bundle identifier on macOS. Use your own reverse-DNS name. |
| `--oneappVersion` | the version of the template package (set when it is packed) | The version of the three OneApp packages to reference. |

## Driving it

```
dotnet oneapp run . --headless --detach     # a Debug build with the development listener on
dotnet oneapp call status
dotnet oneapp click '#count'
dotnet oneapp query '#count'                # "Clicked 1 times"
dotnet oneapp capture --out page.png
dotnet oneapp install .                     # NativeAOT publish and a launcher entry
```

See [harness](https://recursiveai.org/oneapp/docs/harness/) for the verbs and [packaging](https://recursiveai.org/oneapp/docs/packaging/) for install and package formats.

## Building the template from source

`dotnet pack src/OneApp.Templates` writes the package; `dotnet new install <file.nupkg>` installs it from a folder. To try a generated app against unreleased packages, pack the OneApp packages into a folder, add that folder as a source in a `nuget.config` above the app, and pass `--oneappVersion` with the packed version.
