diff --git a/.github/workflows/production_actions.yml b/.github/workflows/production_actions.yml index d61090b..d675709 100644 --- a/.github/workflows/production_actions.yml +++ b/.github/workflows/production_actions.yml @@ -51,9 +51,9 @@ jobs: - name: Restore nuGet packages run: nuget restore $env:Solution_Name - - name: Set path for candle and light - run: echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH - shell: bash + # Update the version inside of the .iss file + - name: Updating the version into the installer + run: (Get-Content SampleRevitAddin.Installer/InstallScript.iss) -replace 'MyAppVersion "1.0.0"', 'MyAppVersion "v${{ steps.gitversion.outputs.majorMinorPatch }}"' | Out-File -encoding ASCII SampleRevitAddin.Installer/InstallScript.iss - name: Run MSBuild id: run-msbuild diff --git a/.github/workflows/staging_actions.yml b/.github/workflows/staging_actions.yml index ff95f54..1a1ac9c 100644 --- a/.github/workflows/staging_actions.yml +++ b/.github/workflows/staging_actions.yml @@ -51,6 +51,10 @@ jobs: - name: Restore nuGet packages run: nuget restore $env:Solution_Name + # Update the version inside of the .iss file + - name: Updating the version into the installer + run: (Get-Content SampleRevitAddin.Installer/InstallScript.iss) -replace 'MyAppVersion "1.0.0"', 'MyAppVersion "v${{ steps.gitversion.outputs.majorMinorPatch }}"' | Out-File -encoding ASCII SampleRevitAddin.Installer/InstallScript.iss + - name: Run MSBuild id: run-msbuild run: | diff --git a/GitVersion.yml b/GitVersion.yml index 0777cbe..af3452f 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,2 +1,2 @@ mode: ContinuousDeployment -next-version: 0.0.1 \ No newline at end of file +next-version: 0.1.1 \ No newline at end of file diff --git a/README.md b/README.md index bad2c91..7d4d39c 100644 --- a/README.md +++ b/README.md @@ -1 +1,25 @@ -# Snack.Revit.Addin \ No newline at end of file +# Snack.Revit.Addin + +## The Path + +As architects-coders, BIM developers, or just power users that build projects or products in the AEC industry, many of us have tested multiple approaches to efficiently coding Revit add-ins. I struggled with this for a while. + +My path and I’m sure many others, started with Dynamo, then PyRevit since I started coding in Python. The ease of use, lack of boilerplate code, and language choice make this a good starting point. But, when complexities arise, tapping into Revit’s API directly is usually the way to go. To do this, we need to use .NET Framework and its flagship programming language: C#. + +In that realm, we need to take care of building the application, packaging it, and deploying it in a frictionless, safe, and scalable way. The problem is there’s no standard recipe to do all this. In fact, [there are many](https://github.com/jeremytammik/VisualStudioRevitAddinWizard). So, how do we do it at e-verse? We’ve gone through plenty of iterations testing and improving our approach. We think sharing it may help other people in the industry who, like me, struggled with finding the most scalable and efficient way to do all this when we first started, using different tedious approaches to, for example, maintain an add-in for multiple Revit versions. + +--- + +## Our Recipe + +Our general add-in structure looks like this: + +1. A git code repository +2. A .NET Framework solution containing multiple projects + - The key here is to have different Class Library projects that compile a single Shared Project, so the code is the same but compiles targeting multiple Revit versions in a single operation +3. A set of NuGet dependencies +4. Post-build events to make debugging and releasing easier +5. A configuration file to manage settings and environment variables outside the main logic +6. CI/CD pipelines leveraging GitHub Actions to take care of releases for development, production, and any other environments needed + +There are several templates and wizards to do this, but here we present our own. Take a look at this [article](https://blog.e-verse.com/build/coding-revit-add-ins-the-e-verse-way) about it. diff --git a/SampleRevitAddin.Installer/InstallScript.iss b/SampleRevitAddin.Installer/InstallScript.iss index e41768b..e8fb483 100644 --- a/SampleRevitAddin.Installer/InstallScript.iss +++ b/SampleRevitAddin.Installer/InstallScript.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "SampleRevitAddin" -#define MyAppVersion "1.0" +#define MyAppVersion "1.0.0" #define MyAppPublisher "e-verse" [Setup] @@ -12,33 +12,38 @@ AppId={{264AD411-643C-43AC-9F07-34523C752100} AppName={#MyAppName} #define installerPath "{commonpf64}\e-verse\Snacks\" AppVersion={#MyAppVersion} -;AppVerName={#MyAppName} {#MyAppVersion} +AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} DefaultDirName={#installerPath} DisableDirPage=yes DefaultGroupName=Revit Extractor DisableProgramGroupPage=yes - #define Revit2020 "\Autodesk\ApplicationPlugins\SampleRevitAddin.bundle\Contents\2020\" #define Revit2021 "\Autodesk\ApplicationPlugins\SampleRevitAddin.bundle\Contents\2021\" #define Revit2022 "\Autodesk\ApplicationPlugins\SampleRevitAddin.bundle\Contents\2022\" #define Revit2023 "\Autodesk\ApplicationPlugins\SampleRevitAddin.bundle\Contents\2023\" - ; Uncomment the following line to run in non administrative install mode (install for current user only.) ;PrivilegesRequired=lowest OutputDir=.\Output OutputBaseFilename=SampleRevitAddin Compression=lzma SolidCompression=yes +SetupIconFile="..\SampleRevitAddin.Resources\Images\Icons\e-verselogo.ico" +OutputManifestFile=Setup-Manifest.txt +UninstallDisplayName="SampleRevitAddin Uninstall" +UninstallDisplayIcon="..\SampleRevitAddin.Resources\Images\Icons\e-verselogo.ico" +WizardSmallImageFile="..\SampleRevitAddin.Resources\Images\Icons\e-verselogo.bmp" WizardStyle=modern [Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" +Name: "english"; MessagesFile: "compiler:Default.isl"; LicenseFile: "..\LICENSE" -[Files] +[Messages] +SetupWindowTitle = Setup {#SetupSetting("AppName")} Version: {#SetupSetting("AppVersion")} +[Files] Source: "..\SampleRevitAddin.2020\bin\Release\*"; DestDir: "{userappdata}{#Revit2020}\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "..\SampleRevitAddin.Common\SampleRevitAddin.addin"; DestDir: "{userappdata}{#Revit2020}\"; Flags: ignoreversion recursesubdirs createallsubdirs diff --git a/SampleRevitAddin.Resources/Images/Icons/e-verselogo.bmp b/SampleRevitAddin.Resources/Images/Icons/e-verselogo.bmp new file mode 100644 index 0000000..0092171 Binary files /dev/null and b/SampleRevitAddin.Resources/Images/Icons/e-verselogo.bmp differ diff --git a/SampleRevitAddin.Resources/Images/Icons/e-verselogo.ico b/SampleRevitAddin.Resources/Images/Icons/e-verselogo.ico new file mode 100644 index 0000000..9eb2ce0 Binary files /dev/null and b/SampleRevitAddin.Resources/Images/Icons/e-verselogo.ico differ diff --git a/SampleRevitAddin.Resources/SampleRevitAddin.Resources.csproj b/SampleRevitAddin.Resources/SampleRevitAddin.Resources.csproj index cad3ea5..3c1d143 100644 --- a/SampleRevitAddin.Resources/SampleRevitAddin.Resources.csproj +++ b/SampleRevitAddin.Resources/SampleRevitAddin.Resources.csproj @@ -53,5 +53,10 @@ Always + + + + + \ No newline at end of file diff --git a/SampleRevitAddin.sln b/SampleRevitAddin.sln index b60187e..0f0489d 100644 --- a/SampleRevitAddin.sln +++ b/SampleRevitAddin.sln @@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleRevitAddin.Installer" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleRevitAddin.Resources", "SampleRevitAddin.Resources\SampleRevitAddin.Resources.csproj", "{87317C2B-AF3A-40AD-865C-093FBAA72440}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3C7DD4D2-E4F4-47CD-88E1-C48C77173C05}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU