Skip to content

Instantly share code, notes, and snippets.

@karl-sjogren
Created September 8, 2013 07:45
Show Gist options
  • Save karl-sjogren/6482718 to your computer and use it in GitHub Desktop.
Save karl-sjogren/6482718 to your computer and use it in GitHub Desktop.
Creating an NSIS-installer for an Add-in Express project.
Section "Office Addins"
; To make this check you need the FindProc-plugin for NSIS and the
; macro defined below in the article.
!insertmacro CheckAppRunning "OUTLOOK" "OUTLOOK.EXE" "Microsoft Outlook"
!insertmacro CheckAppRunning "EXCEL" "EXCEL.EXE" "Microsoft Excel"
!insertmacro CheckAppRunning "WORD" "WINWORD.EXE" "Microsoft Word"
!insertmacro CheckAppRunning "POWERPOINT" "POWERPOINT.EXE" "Microsoft PowerPoint"
SetOutPath "$INSTDIR"
; We need a few files from the Add-in Express folders, you might need
; to update the paths to match your system though.
File "C:\Program Files (x86)\Add-in Express\Add-in Express for .NET\Redistributables\adxregistrator.exe"
File "C:\Program Files (x86)\Add-in Express\Add-in Express for .NET\Bin\AddinExpress.MSO.2005.dll"
; We need all outputted files from the project, make sure that you have registered
; the project with Office at least once so that the adxloader-dlls are available
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\adxloader.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\adxloader.dll.manifest"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\adxloader64.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\Microsoft.Office.Interop.Excel.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\Microsoft.Office.Interop.Outlook.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\Microsoft.Office.Interop.PowerPoint.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\Microsoft.Office.Interop.Word.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\Microsoft.Vbe.Interop.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\Office.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\Shorthand.Core.OfficeAddins2.Addin.dll"
File "..\Shorthand.Core.OfficeAddins2.Addin\bin\Release\Shorthand.Core.OfficeAddins2.Addin.tlb"
; Finally we call adxregistrator.exe with the path to our dll to register it on the target system
ExecWait "$INSTDIR\adxregistrator.exe /install=$\"$INSTDIR\Shorthand.Core.OfficeAddins2.Addin.dll$\" /privileges=user /returnExitCode=false"
SectionEnd
Section Uninstall
; And of course, when we run the uninstaller we call adxregistrator.exe again to unregister the addin
ExecWait "$INSTDIR\Office Addins\adxregistrator.exe /uninstall=$\"$INSTDIR\Shorthand.Core.OfficeAddins2.Addin.dll$\" /privileges=user"
SectionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment