Skip to content

Commit

Permalink
actions to update the version in the installer (#1) (#2)
Browse files Browse the repository at this point in the history
* Update README.md

* actions to update the version in the installer
adding license.txt file to the .iss file
adding icons to the installer

* unnecessary license deleted

* Bump version, add version update to staging action, remove duplicate license.

---------

Co-authored-by: Daniel Pinheiro <[email protected]>
  • Loading branch information
franmaranchello and danielpinheiros authored Jan 30, 2023
1 parent c522c68 commit 4b50fb4
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/production_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/staging_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mode: ContinuousDeployment
next-version: 0.0.1
next-version: 0.1.1
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
# Snack.Revit.Addin
# 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.
17 changes: 11 additions & 6 deletions SampleRevitAddin.Installer/InstallScript.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions SampleRevitAddin.Resources/SampleRevitAddin.Resources.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Files\Text\license.txt" />
<Content Include="Images\Icons\e-verselogo.bmp" />
<Content Include="Images\Icons\e-verselogo.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 2 additions & 0 deletions SampleRevitAddin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b50fb4

Please sign in to comment.