Skip to content

Commit e899881

Browse files
committed
Actualizado Primeraprueba para que instale en revit2024
1 parent e39a677 commit e899881

7 files changed

Lines changed: 53 additions & 4 deletions

File tree

3Guia maestra desarrollo add-ins Revit 2024.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ Ventajas de usar este flujo:
6060
- Soporte multiversión integrado
6161
- Estructura profesional desde el minuto cero
6262

63+
## **3.2 Configuración Crítica del Archivo `.csproj`**
64+
65+
Al usar plantillas modernas (como Nice3point), el compilador inyecta muchos espacios de nombres globales de forma automática (Revit API, Nice3point Extensions, colecciones genéricas de .NET, JetBrains.Annotations, etc.).
66+
67+
**Regla de Oro:**
68+
- Asegúrate **SIEMPRE** de que **`<ImplicitUsings>enable</ImplicitUsings>`** esté configurado en tu archivo `.csproj`.
69+
- **Nunca establezcas** `<ImplicitUsings>disable</ImplicitUsings>`. Si lo desactivas, los métodos de extensión esenciales (como `Application.CreatePanel()`), las colecciones genéricas y otras dependencias fallarán al compilar y requerirán importaciones de namespaces manuales en todo el código.
70+
6371
---
6472

6573
# **4. Anatomía de un Add-in de Revit**

PrimeraPrueba/Application.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
using Nice3point.Revit.Toolkit.External;
1+
using Nice3point.Revit.Toolkit.External;
22
using PrimeraPrueba.Commands;
3-
3+
using JetBrains.Annotations;
4+
using Nice3point.Revit.Extensions;
45
namespace PrimeraPrueba;
56

67
/// <summary>

PrimeraPrueba/Commands/StartupCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using PrimeraPrueba.Services;
44
using PrimeraPrueba.ViewModels;
55
using PrimeraPrueba.Views;
6+
using JetBrains.Annotations;
67

78
namespace PrimeraPrueba.Commands;
89

PrimeraPrueba/PrimeraPrueba.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<LaunchRevit>true</LaunchRevit>
77
<IsRepackable>false</IsRepackable>
88
<EnableDynamicLoading>true</EnableDynamicLoading>
9-
<ImplicitUsings>disable</ImplicitUsings>
9+
<ImplicitUsings>enable</ImplicitUsings>
1010
<Configurations>Debug.R23;Debug.R24;Debug.R25;Debug.R26;Debug.R27</Configurations>
1111
<Configurations>$(Configurations);Release.R23;Release.R24;Release.R25;Release.R26;Release.R27</Configurations>
1212
</PropertyGroup>

PrimeraPrueba/Services/RevitSelectionService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using Autodesk.Revit.DB;
22
using Autodesk.Revit.UI;
33
using PrimeraPrueba.Models;
4+
using System.Collections.Generic;
5+
using System.Linq;
46

57
namespace PrimeraPrueba.Services;
68

PrimeraPrueba/ViewModels/SelectionFilterViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
using PrimeraPrueba.Models;
44
using PrimeraPrueba.Services;
55
using System.Collections.ObjectModel;
6-
6+
using System.Collections.Generic;
7+
using System.Linq;
78
namespace PrimeraPrueba.ViewModels;
89

910
public partial class SelectionFilterViewModel : ObservableObject
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: create-revit-installer
3+
description: When a user wants to create an installer (.msi or .exe) for a Revit add-in. Do not use for non-Revit projects.
4+
---
5+
6+
# Purpose
7+
To create a professional software installer that automatically deploys a Revit add-in (`.addin` and `.dll` dependencies) to the correct `%AppData%\Autodesk\Revit\Addins\<Version>` directory on target computers.
8+
9+
# When to use
10+
Whenever a user requests to build an installer, create an MSI, create an EXE, or "empaquetar" a Revit plugin for distribution.
11+
12+
# Inputs
13+
The agent needs:
14+
- The path to the compiled Revit add-in source code.
15+
- Knowledge of the user preferences (MSI via WiX toolset vs EXE via Inno Setup).
16+
- Target Revit versions (e.g. 2024, or 2023+2024+2025).
17+
18+
# Workflow
19+
1. **Clarify Requirements:** BEFORE generating any code, creating templates, or executing commands, YOU MUST ask the user:
20+
- "¿Quieres generar un archivo .msi (empleando la plantilla oficial de Nice3point WiX) o prefieres crear un instalador .exe (mediante Inno Setup script)?"
21+
- "¿Para qué versiones de Revit deseas que sea válido el instalador? (Pregunta por versiones específicas como 2024, o si desea que instale en todas las versiones detectadas)."
22+
2. **Wait for user response.** (Do not proceed until you have this information).
23+
3. **Compile the Add-in:** Ensure the add-in is compiled in `Release` mode for the chosen Revit versions.
24+
4. **Implement Selected Installer Strategy:**
25+
- **If WiX (.msi):** Use the command `dotnet new wix` (provided by `Nice3point.Revit.Templates.Installer`) to generate the installer project structure. Configure the `<Wix>` XML properties to copy the output files into `[AppDataFolder]Autodesk\Revit\Addins\<Version>`.
26+
- **If Inno Setup (.exe):** Create an `installer.iss` script. Set the `DestDir` flag for your `[Files]` block to `{userappdata}\Autodesk\Revit\Addins\<Version>`.
27+
5. **Multi-version Multi-targeting:** If the user requested an installer for multiple versions of Revit, the scripts `.wxs` or `.iss` must reflect deploying files to each iteration of the folder (e.g., `Addins\2023`, `Addins\2024`, `Addins\2025`).
28+
6. **Compile Installer:** Process the installer project (e.g., via `dotnet build` for WiX, or executing `iscc.exe` over the Inno Setup script) to generate the final file.
29+
30+
# Validation
31+
- Ensure the output `.exe` or `.msi` file was actually successfully generated.
32+
- Verify that the target directories inside the installer configuration strictly map to the Revit Add-In AppData paths.
33+
34+
# Common pitfalls
35+
- Not copying the `.addin` file; without the `.addin` manifest at the root of `Addins\<Version>`, Revit will not load the plugin, even if the `.dll` is present via the installer.
36+
- Hardcoding absolute paths instead of using `%AppData%` aliases (`[AppDataFolder]` in WiX or `{userappdata}` in InnoSetup).

0 commit comments

Comments
 (0)