SuperAPI AI Directory

saury-revit

Coding & development

View repository

Updated 10-19 01:10

About this skill

Saury Revit Project Creator

Based on the Saury.Revit.Template dotnet template, create a fully configured Revit 2026 add-in project (MVVM + DI architecture) through an interactive process.

Workflow

Execute the following steps in order, and proceed to the next step only after each step is completed.

Step 1: Interactively confirm the project configuration

Before executing any command, you must confirm the following information with the user:

Required:

  1. Project name — must be a valid C# namespace name (e.g., Acme.WallTools、JD.RevitHelper), default RevitDemo or RevitTest. This name will be used for the solution, project folder, namespace, assembly, addin file, and Ribbon tab.
  2. Project creation directory — defaults to the current working directory.

Optional (has default values, only needs confirmation): 3. Revit version — default 2026, specified via the --RevitVersion parameter.

After the user confirms, summarize the configuration and have the user give final confirmation before executing.

Step 2: Check and install the .NET environment

Detection process (execute in order):

  1. Detect whether the dotnet CLI exists:
where dotnet
  1. If the command exists, detect the SDK version:
dotnet --list-sdks

Check whether the output contains 8.0 or a higher SDK version.

  1. Determine the result:
    • dotnet CLI exists and SDK 8.0+ is installed → skip, proceed to the next step
    • dotnet CLI exists but no SDK or insufficient version → need to install the SDK
    • dotnet CLI does not exist → need a full installation

Installation methods (try in order of priority):

winget install Microsoft.DotNet.SDK.8
  • After installation is complete, re-verify:where dotnet && dotnet --list-sdks
  • If winget is unavailable, use the official script to install instead:
Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
./dotnet-install.ps1 -Channel 8.0
  • If all the above methods fail, tell the user to manually download .NET 8.0 SDK

Step 3: Install the template

# 检查是否已安装
dotnet new list saury-revit
  • If already installed → skip, inform the user that it is currently installed
  • If not installed → perform the installation:
dotnet new install Saury.Revit.Template
  • If an update is needed → dotnet new install Saury.Revit.Template --force

Step 4: Create the project

dotnet new saury-revit -n <项目名称> -o <输出目录>
Parameter Description Example
-n Project name (replaces all Saury.Revit.Template) Acme.WallTools
-o Output directory ./Acme.WallTools
--RevitVersion Revit version (default 2026) 2026

The template automatically completes:

  • Global replacement of Saury.Revit.Template → user project name
  • Automatically generate a unique GUID to replace ADDIN-GUID-PLACEHOLDER
  • Exclude .template.config/、bin/、obj/、.vs/、Logs/、*.user

Step 5: Verify the project structure

After creation, list the directory to confirm the structure is complete:

<项目名称>/
├── <项目名称>.slnx
└── <项目名称>/
    ├── 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
    ├── <项目名称>.addin
    └── <项目名称>.csproj

Step 6: Build verification

cd <输出目录>
dotnet restore
dotnet build --configuration Debug_R26

Key: This project uses Debug_R26 / Release_R26,Do notuse the standard Debug / Release, otherwise the build will fail.

After a successful build, the compiled output is automatically copied to C:\ProgramData\Autodesk\Revit\Addins\2026\。

Step 7: Tell the user how to use it

After a successful build, show the user the following usage instructions:

Debug launch configuration

  1. Modify the Revit path — Open <项目名称>.csproj, find the StartProgram property, and confirm that the path points to the local Revit installation location:
<StartProgram>C:\Program Files\Autodesk\Revit 2026\Revit.exe</StartProgram>

If Revit is installed in a non-default path, it must be changed to the actual path.

  1. Open with Visual Studio or Rider <项目名称>.slnx
  2. Select the build configuration Debug_R26(toolbar dropdown,do not select Debug)
  3. Click Start/F5 — automatically compile → copy the output to the Addins directory → start Revit → attach the debugger
  4. After Revit starts — find the plugin button in the Ribbon tab and click it to trigger breakpoint debugging

Subsequent customization

  1. Vendor information(<项目名称>.addin)— VendorId、VendorDescription、VendorEmail
  2. About page information(Models/AboutInfo.cs)— GiteeUrl、Description
  3. Add new features — see architecture.md

Add new features

When the user requests adding a new feature to an already created project, read references/architecture.md to get the complete code templates and rule constraints, and strictly follow the A→F six-step process:

  1. Model → Models/ directory
  2. ViewModel → ViewModels/ directory (partial class, inherit ObservableObject)
  3. View → Views/ directory (constructor injects ViewModel)
  4. Command → Commands/ directory ([Transaction(TransactionMode.Manual)])
  5. DI registration → Host.cs(AddTransient)
  6. Ribbon button → Application.cs the CreateRibbon method

Prohibitions

  • Do not use the Debug / Release configuration; only use Debug_R26 / Release_R26
  • Do not manually new View or ViewModel; it must be obtained through Host.GetService<T>() Get
  • Do not write business logic in the View code-behind
  • Do not directly call MessageBox in the ViewModel or operate on Window
  • Do not hard-code configuration values; use appsettings.json + IOptions<T>
  • Unless the user explicitly requests it, do not delete the example About feature