Scaffolding Revit Projects
The Nice3point.Revit.Templates package provides dotnet new templates for Revit add-ins, solutions, benchmarks, and tests, already wired to Nice3point.Revit.Sdk.
Choose the project topology before generating files.
Choosing the wrong project shape causes either a monolithic add-in or a modular add-in without a host.
These rules apply to every generated project:
- Template options define the project shape. Generate a fresh project with the needed options; do not add generated infrastructure by hand.
- A
Debug.RNNorRelease.RNNconfiguration targets one Revit year. ReplaceNNwith the final two digits of that year; for example,Debug.R27targets Revit 2027.
When to use
- Starting a new Revit add-in, benchmark, or test project or solution.
Workflow
Step 1: Install the templates
dotnet new install Nice3point.Revit.Templates
Step 2: Select the template and its options
Match the required outcome to one reference and open only that reference.
- references/revit-addin-solution.md — Load when: a repository needs a standard layout, default root files, ModularPipelines build, MSI installer, App Store bundle, tests, or CI.
- references/revit-addin.md — Load when: a small self-contained add-in needs one project that owns its manifest, entry point, UI.
- references/revit-addin-application.md — Load when: creating the manifest-owning host for a modular add-in; use it with
revit-addin-module. - references/revit-addin-module.md — Load when: adding one modular feature, service, or WPF MVVM area to an application host.
- references/revit-benchmark.md — Load when: measuring Revit API code with BenchmarkDotNet inside Revit.
- references/revit-tunit.md — Load when: creating a TUnit test project that runs inside Revit.
Step 3: Generate the project or solution
dotnet new revit-addin-sln --name MyAddin
Pass only the options that change the default shape. For example, create a solution with an App Store bundle and tests:
dotnet new revit-addin-sln --name MyAddin --bundle --includeTests
For a modular solution, create the host and a module under source, then add the module reference to the host:
dotnet new revit-addin-application --name MyAddin
dotnet new revit-addin-module --name MyFeature
dotnet add MyAddin/MyAddin.csproj reference MyFeature/MyFeature.csproj
Step 4: Initialize the solution repository
For a solution, create add-in projects under source and make an initial Git commit before running its build.
ModularPipelines and GitVersion need repository history.
git init
git add .
git commit -m "Initial commit"
Step 5: Verify
Restore and build a declared Debug.RNN configuration.
For a solution, run its ModularPipelines build from build.
dotnet build <ProjectPath> --configuration Debug.RNN
cd build
dotnet run
Validation
- The templates are installed via
dotnet new install Nice3point.Revit.Templates. - The chosen template and options match the intended topology and output.
- A modular add-in has an application host, modules referenced from that host, and entry points in the host.
- A solution has an initial Git commit before its build runs.
- The generated project builds for one declared
Debug.RNNorRelease.RNNconfiguration.
Common Pitfalls
| Pitfall | Correct approach |
|---|---|
| Treating an application template as a complete modular add-in | Create it with one or more modules, then add project references from the application to modules. |
| Putting commands or ribbon registration in a module | Keep Revit entry points in the application project. |
| Guessing a template option | Open the reference for that template and use its documented CLI option. |
| Building a scaffolded solution before committing | Commit first; GitVersion needs history. |