ricaun.Revit.Sdk
1.0.0
Prefix Reserved
<Sdk Name="ricaun.Revit.Sdk" Version="1.0.0" />
#:sdk ricaun.Revit.Sdk@1.0.0
ricaun.Revit.Sdk
Sdk for Revit API development to support multiple Revit versions in a single project.
Features
- Automatic
TargetFrameworksusing TFM-Aliases for Revit versions. - Automatic
Definesusing or-greater-defines for Revit versions.
Installation
To install the SDK, you need to specify in the Sdk attribute of the Project element in your project file.
<Project Sdk="ricaun.Revit.Sdk/1.0.0">
</Project>
TargetFrameworks
The Sdk support the following TargetFrameworks for Revit versions:
<Project Sdk="ricaun.Revit.Sdk/1.0.0">
<PropertyGroup>
<TargetFrameworks>2027;2026;2025;2024;2023;2022;2021</TargetFrameworks>
</PropertyGroup>
</Project>
The RevitVersion is set based in the TargetFrameworks number.
Configurations
The Sdk support Configurations for Revit versions and the TargetFramework is automatically set by the Sdk depending on the Configuration:
<Project Sdk="ricaun.Revit.Sdk/1.0.0">
<PropertyGroup>
<Configuration>2027;Debug 2027;2026;Debug 2026;2025;Debug 2025;2024;Debug 2024</Configuration>
</PropertyGroup>
</Project>
The RevitVersion is set based in the Configuration number.
The OutputPath is automatically set between bin\Debug\<RevitVersion> and bin\Release\<RevitVersion> depending on the Configuration name, and the DefineConstants is set between DEBUG or RELEASE.
AppendRevitVersionToOutputPath
The property AppendRevitVersionToOutputPath is automatically set to true when using the Configuration property. You can override this behavior by setting it to false in your project file.
RevitVersion
The property group RevitVersion is set to the Revit version depending on the TargetFrameworks or Configurations.
<ItemGroup>
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>
IsRevitVersion
These properties IsRevitVersionNetCore and IsRevitVersionNetFramework are set depending on whether the Revit version is targeting .NET Core or .NET Framework.
<PropertyGroup Condition="$(IsRevitVersionNetFramework)">
<Reference Include="System.IO.Compression" />
</PropertyGroup>
Defines Constants
The defines REVIT and REVIT<version> are set depending on the Revit version.
The REVIT<version>_OR_GREATER defines are set for the Revit version and all greater versions.
| RevitVersion | Define | Define with or-greater |
|---|---|---|
| 2019 | REVIT, REVIT2019 |
REVIT2019_OR_GREATER |
| 2020 | REVIT, REVIT2020 |
REVIT2019_OR_GREATER, REVIT2020_OR_GREATER |
| 2021 | REVIT, REVIT2021 |
REVIT2019_OR_GREATER, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER |
| 2022 | REVIT, REVIT2022 |
REVIT2019_OR_GREATER, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER, REVIT2022_OR_GREATER |
| 2023 | REVIT, REVIT2023 |
REVIT2019_OR_GREATER, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER, REVIT2022_OR_GREATER, REVIT2023_OR_GREATER |
| 2024 | REVIT, REVIT2024 |
REVIT2019_OR_GREATER, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER, REVIT2022_OR_GREATER, REVIT2023_OR_GREATER, REVIT2024_OR_GREATER |
| 2025 | REVIT, REVIT2025 |
REVIT2019_OR_GREATER, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER, REVIT2022_OR_GREATER, REVIT2023_OR_GREATER, REVIT2024_OR_GREATER, REVIT2025_OR_GREATER |
| 2026 | REVIT, REVIT2026 |
REVIT2019_OR_GREATER, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER, REVIT2022_OR_GREATER, REVIT2023_OR_GREATER, REVIT2024_OR_GREATER, REVIT2025_OR_GREATER, REVIT2026_OR_GREATER |
| 2027 | REVIT, REVIT2027 |
REVIT2019_OR_GREATER, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER, REVIT2022_OR_GREATER, REVIT2023_OR_GREATER, REVIT2024_OR_GREATER, REVIT2025_OR_GREATER, REVIT2026_OR_GREATER, REVIT2027_OR_GREATER |
By default the lowest version is set to 2019, the RevitVersionMinimal property can be set to a different version to change the lowest version for the REVIT<version>_OR_GREATER defines:
<PropertyGroup>
<RevitVersionMinimal>2019</RevitVersionMinimal>
</PropertyGroup>
AppLoader
The property AppLoader is used change how the AssemblyName is generated.
- The
Versionkeywork is used to generate theAssemblyNamewith the assembly version. - The
Debugkeyword is used to generate theAssemblyNamewith a timestamp number. (Only available withDebugconfiguration.)
<PropertyGroup>
<AppLoader>Debug;Version</AppLoader>
</PropertyGroup>
This property is used work with the plugin ricaun.AppLoader.
Sdk Properties
The Sdk sets the following properties automatically:
| Property | Value | Description |
|---|---|---|
| TargetFramework | dynamic | Automatically sets the TargetFramework based on the RevitVersion property. |
| LangVersion | latest | Sets the latest C# language version |
| PlatformTarget | AnyCPU | The platform target any CPU |
| ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch | None | Ignore the warning for assembly architecture mismatch |
| Optimize | dynamic | Enabled for Release configurations. |
| DebugSymbols | dynamic | Enabled for Debug configurations. |
| DebugType | dynamic | portable for Debug, none for Release configurations. |
TargetFrameworks defaults values
The TargetFrameworks defaults to the following values depending on the RevitVersion property:
| RevitVersion | TargetFramework |
|---|---|
| 2017-2018 | net46 |
| 2019-2020 | net47 |
| 2021-2024 | net48 |
| 2025-2026 | net8.0-windows |
| 2027-2028 | net10.0-windows |
| 2029-2030 | net12.0-windows |
| 2031-2032 | net14.0-windows |
Learn more about Target Frameworks and .NET Standard.
This package has 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.