Saury Revit Project Creator
Based on the
dotnet template, create a fully configured Revit 2026 plugin project (MVVM + DI architecture) through an interactive process.
Workflow
Execute the following steps in order, proceed to the next step only after completing the current one.
Step 1: Interactive Confirmation of Project Configuration
Before executing any commands, you must confirm the following information with the user:
Required Questions:
- Project Name — Must be a valid C# namespace name (e.g., , ), default is or . This name will be used for the solution, project folder, namespace, assembly, addin file, and Ribbon tab.
- Project Creation Directory — Defaults to the current working directory.
Optional (with default values, only need confirmation):
3.
Revit Version — Default is
, specified via the
parameter.
After user confirmation, summarize the configuration and ask for final confirmation before execution.
Step 2: Check and Install .NET Environment
Detection Process (execute in order):
- Check if dotnet CLI exists:
- If the command exists, check SDK version:
Check if the output includes SDK version
or higher.
- Judgment Results:
- dotnet CLI exists and SDK 8.0+ is installed → Skip, proceed to next step
- dotnet CLI exists but no SDK or version is insufficient → Need to install SDK
- dotnet CLI does not exist → Need full installation
Installation Methods (try in priority order):
bash
winget install Microsoft.DotNet.SDK.8
- Re-verify after installation:
where dotnet && dotnet --list-sdks
- If is unavailable, use the official script for installation:
powershell
Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
./dotnet-install.ps1 -Channel 8.0
- If the above methods all fail, inform the user to download .NET 8.0 SDK manually
Step 3: Install Template
bash
# Check if already installed
dotnet new list saury-revit
- If already installed → Skip, inform the user it's already installed
- If not installed → Execute installation:
bash
dotnet new install Saury.Revit.Template
- If update is needed →
dotnet new install Saury.Revit.Template --force
Step 4: Create Project
bash
dotnet new saury-revit -n <Project Name> -o <Output Directory>
| Parameter | Description | Example |
|---|
| Project Name (replaces all instances of ) | |
| Output Directory | |
| Revit Version (default 2026) | |
Template Auto-Completion:
- Global replacement of → User's project name
- Automatically generate unique GUID to replace
- Exclude , , , , ,
Step 5: Verify Project Structure
After creation, list the directory to confirm the structure is complete:
<Project Name>/
├── <Project Name>.slnx
└── <Project Name>/
├── Commands/AboutCommand.cs
├── Extensions/DataContextExtension.cs
├── Models/AboutInfo.cs
├── ViewModels/AboutViewModel.cs
├── Views/AboutView.xaml(.cs)
├── Resources/Icons/about.png
├── Resources/Styles/ButtonStyles.xaml
├── Services/Interfaces/
├── Application.cs
├── Host.cs
├── appsettings.json
├── <Project Name>.addin
└── <Project Name>.csproj
Step 6: Build Verification
bash
cd <Output Directory>
dotnet restore
dotnet build --configuration Debug_R26
Critical Note: This project uses
/
,
do not use the standard
/
, otherwise the build will fail.
After successful build, the compiled artifacts are automatically copied to
C:\ProgramData\Autodesk\Revit\Addins\2026\
.
Step 7: Inform User on How to Use
After successful build, display the following usage instructions to the user:
Debug Launch Configuration
- Modify Revit Path — Open , find the property, confirm the path points to the local Revit installation location:
xml
<StartProgram>C:\Program Files\Autodesk\Revit 2026\Revit.exe</StartProgram>
If Revit is installed in a non-default path, modify it to the actual path.
- Open with Visual Studio or Rider
- Select build configuration (toolbar dropdown, do not select )
- Click Start/F5 — Automatic compilation → Artifacts copied to Addins directory → Launch Revit → Attach debugger
- After Revit starts — Find the plugin button in the Ribbon tab, click it to trigger breakpoint debugging
Subsequent Customization
- Vendor Information () — VendorId, VendorDescription, VendorEmail
- About Page Information () — GiteeUrl, Description
- Add New Features — Refer to architecture.md
Add New Features
When users request to add new features to an existing project, read architecture.md to get complete code templates and rule constraints, and strictly follow the 6-step process from A to F:
- Model → directory
- ViewModel → directory (partial class, inherits )
- View → directory (constructor injects ViewModel)
- Command → directory (
[Transaction(TransactionMode.Manual)]
)
- DI Registration → ()
- Ribbon Button → method in
Prohibited Actions
- Do not use / configurations, only use /
- Do not manually View or ViewModel, must obtain via
- Do not write business logic in View code-behind
- Do not directly call or operate in ViewModel
- Do not hardcode configuration values, use +
- Unless explicitly requested by the user, do not delete the sample About feature