Community.MauiRust.Templates
1.0.0-pre4
dotnet new install Community.MauiRust.Templates@1.0.0-pre4
Community.MauiRust.Templates
dotnet new templates for .NET MAUI apps with a Rust native library wired into MSBuild.
Press F5 — Rust builds automatically alongside C#, on Windows, Android, iOS, and MacCatalyst.
For users — install, create, update
Install
dotnet new install Community.MauiRust.Templates
Update to a newer template version
dotnet new update
This updates all installed template packages, including Community.MauiRust.Templates.
Existing projects are not affected — only new projects created after the update use the new template.
Uninstall
dotnet new uninstall Community.MauiRust.Templates
Create a new project
dotnet new maui-rust -n MyApp
This produces:
MyApp/
├── MyApp.sln
├── check-prerequisites.ps1 ← run on Windows to verify build prerequisites
├── check-prerequisites.sh ← run on macOS/Linux to verify build prerequisites
├── Prerequisites.md ← full setup guide
├── app/
│ └── MyApp/
│ └── MyApp.csproj ← MAUI app, MSBuild wires Rust automatically
└── rust/
└── myapp_native/ ← Rust crate (name derived from project name)
├── Cargo.toml
└── src/lib.rs ← your Rust FFI entry points
Open MyApp.sln in Visual Studio, select a target, press F5.
MSBuild runs cargo build before the MAUI build. No separate terminal needed.
Before building — verify prerequisites
Every generated project includes scripts that check what is missing:
# Windows
.\check-prerequisites.ps1
# macOS / Linux
chmod +x check-prerequisites.sh && ./check-prerequisites.sh
Each script reports what is installed and what is not, with the exact fix command for each missing item. See Prerequisites.md in the generated project for the full setup guide.
For developers — edit, test locally, publish
Repo layout
Community.MauiRust.Templates/
├── Community.MauiRust.Templates.csproj ← NuGet packaging project
├── .github/workflows/
│ └── publish.yml ← publishes on git tag push
└── content/
└── MauiRust/ ← template source (sourceName = "MauiRust")
├── .template.config/
│ └── template.json ← template metadata
├── MauiRust.sln
├── app/MauiRust/ ← MAUI project
└── rust/mauirustnativelib_native/ ← Rust crate (renamed on instantiation)
The sourceName = "MauiRust" setting in template.json replaces every occurrence of
MauiRust — in file content, file names, and directory names — with the user-supplied
project name. A separate casing generator replaces mauirustnativelib (the token
embedded in crate and directory names) with the lowercased project name, so
mauirustnativelib_native becomes e.g. myapp_native.
Edit the template
All template content lives under content/MauiRust/. Edit it like any normal project.
- C# namespace and class names: use
MauiRust— it will be replaced on instantiation. - Rust crate name: keep
mauirustnativelibas the token inside crate/dir names — it is lowercased to the project name on instantiation (e.g.myapp_native). - MAUI project file:
app/MauiRust/MauiRust.csproj. - Rust source:
rust/mauirustnativelib_native/src/lib.rs.
Test locally without publishing
Step 1 — pack:
dotnet pack -c Release -o ./nupkg
Step 2 — install the local package:
dotnet new install ./nupkg/Community.MauiRust.Templates.1.0.0.nupkg
Step 3 — create a test project:
dotnet new maui-rust -n TestApp -o /tmp/TestApp
Inspect /tmp/TestApp to confirm the name substitution is correct.
Step 4 — uninstall when done:
dotnet new uninstall Community.MauiRust.Templates
Repeat from Step 1 after each edit. The version in the .nupkg filename comes from
<PackageVersion> in Community.MauiRust.Templates.csproj — bump it to avoid NuGet's local cache
serving an old package.
Bump the version
Edit Community.MauiRust.Templates.csproj:
<PackageVersion>1.1.0</PackageVersion>
Or override on the CLI without editing the file (useful for CI):
dotnet pack -c Release -p:PackageVersion=1.1.0 -o ./nupkg
Publish to NuGet.org and GitHub Packages
One-time setup — add the secret to GitHub:
| Secret | What it is | Where to get it |
|---|---|---|
NUGET_API_KEY |
NuGet.org API key scoped to push packages | NuGet.org → Create → scope to Community.MauiRust.Templates, select Push new packages and package versions |
GITHUB_TOKEN (used for GitHub Packages) is provided automatically — no secret to create.
Publish:
- Bump
<PackageVersion>inCommunity.MauiRust.Templates.csprojand commit. - Go to Actions → Publish NuGet → Run workflow.
- Choose whether to publish to NuGet.org, GitHub Packages, or both.
- Click Run workflow.
The workflow packs first, then publishes to the selected registries in parallel. The package is live on NuGet.org within a few minutes.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-pre4 | 278 | 4/25/2026 |
| 1.0.0-pre3 | 267 | 4/25/2026 |
| 1.0.0-pre11 | 254 | 4/26/2026 |