Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Wix to InnoSetup #96

Merged
merged 6 commits into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions OfficeRibbonXEditor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{017FBD33-4473-4DD2-ADEA-CAA00B695055}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Installer", "src\Installer\Installer.wixproj", "{414E2267-764A-4E61-AA5E-F25F407DFAFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{D8B42177-9C73-48C9-971E-1D435353FF17}"
ProjectSection(SolutionItems) = preProject
build\CopyLibraries.ps1 = build\CopyLibraries.ps1
Expand Down Expand Up @@ -54,6 +52,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sign", "sign", "{F74BE762-F
build\sign\sign.ps1 = build\sign\sign.ps1
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "install", "install", "{DEDAFECB-4AF8-4D7D-AE78-1C785D3B63FE}"
ProjectSection(SolutionItems) = preProject
build\install\setup.iss = build\install\setup.iss
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -70,13 +73,6 @@ Global
{A2A7BCC6-735E-4424-93A4-4EA5255E01FC}.Release|Any CPU.Build.0 = Release|Any CPU
{A2A7BCC6-735E-4424-93A4-4EA5255E01FC}.Release|x86.ActiveCfg = Release|Any CPU
{A2A7BCC6-735E-4424-93A4-4EA5255E01FC}.Release|x86.Build.0 = Release|Any CPU
{414E2267-764A-4E61-AA5E-F25F407DFAFD}.Debug|Any CPU.ActiveCfg = Debug|x86
{414E2267-764A-4E61-AA5E-F25F407DFAFD}.Debug|x86.ActiveCfg = Debug|x86
{414E2267-764A-4E61-AA5E-F25F407DFAFD}.Debug|x86.Build.0 = Debug|x86
{414E2267-764A-4E61-AA5E-F25F407DFAFD}.Release|Any CPU.ActiveCfg = Release|x86
{414E2267-764A-4E61-AA5E-F25F407DFAFD}.Release|Any CPU.Build.0 = Release|x86
{414E2267-764A-4E61-AA5E-F25F407DFAFD}.Release|x86.ActiveCfg = Release|x86
{414E2267-764A-4E61-AA5E-F25F407DFAFD}.Release|x86.Build.0 = Release|x86
{D1A56613-DC3E-4DF9-A560-6456CDF89378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1A56613-DC3E-4DF9-A560-6456CDF89378}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1A56613-DC3E-4DF9-A560-6456CDF89378}.Debug|x86.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -115,13 +111,13 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A2A7BCC6-735E-4424-93A4-4EA5255E01FC} = {017FBD33-4473-4DD2-ADEA-CAA00B695055}
{414E2267-764A-4E61-AA5E-F25F407DFAFD} = {017FBD33-4473-4DD2-ADEA-CAA00B695055}
{D1A56613-DC3E-4DF9-A560-6456CDF89378} = {5FB6177B-63FD-4817-A7ED-D1FA2D6EBEAF}
{240C0BA9-5B29-430F-9325-2C0D74A1ED35} = {5FB6177B-63FD-4817-A7ED-D1FA2D6EBEAF}
{8E404929-0EA1-41BF-AA5F-5CD75B1EE4FC} = {5FB6177B-63FD-4817-A7ED-D1FA2D6EBEAF}
{C346825D-3DC7-4AF6-A415-BFEB2E6465AB} = {D8B42177-9C73-48C9-971E-1D435353FF17}
{BA0E6FC1-EE48-42AB-AF21-0349EC51FE52} = {5FB6177B-63FD-4817-A7ED-D1FA2D6EBEAF}
{F74BE762-F575-4011-A85E-725CDC28D2AE} = {D8B42177-9C73-48C9-971E-1D435353FF17}
{DEDAFECB-4AF8-4D7D-AE78-1C785D3B63FE} = {D8B42177-9C73-48C9-971E-1D435353FF17}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8E5E4631-F9D6-43A1-B677-FD1B0C599606}
Expand Down
9 changes: 7 additions & 2 deletions azure-pipelines-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,20 @@ jobs:
archiveFile: '$(Build.ArtifactStagingDirectory)/OfficeRibbonXEditor-NETFramework.zip'
- powershell: >-
Copy-Item
-Path "$(Pipeline.Workspace)/.NET Framework Installer/OfficeRibbonXEditor.msi"
-Destination "$(Build.ArtifactStagingDirectory)/OfficeRibbonXEditor-NETFramework.msi"
-Path "$(Pipeline.Workspace)/.NET Framework Installer/OfficeRibbonXEditor.exe"
-Destination "$(Build.ArtifactStagingDirectory)/OfficeRibbonXEditor-Installer-NETFramework.exe"
displayName: 'Copy .NET Framework Installer'
- task: ArchiveFiles@2
displayName: 'Archive .NET Core Binaries'
inputs:
rootFolderOrFile: '$(Pipeline.Workspace)/.NET Core Binaries/OfficeRibbonXEditor'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/OfficeRibbonXEditor-NETCore.zip'
- powershell: >-
Copy-Item
-Path "$(Pipeline.Workspace)/.NET Core Installer/OfficeRibbonXEditor.exe"
-Destination "$(Build.ArtifactStagingDirectory)/OfficeRibbonXEditor-Installer-NETCore.exe"
displayName: 'Copy .NET Core Installer'
- task: GitHubRelease@1
displayName: 'Create GitHub Release'
inputs:
Expand Down
39 changes: 37 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,18 @@ stages:
fileName: 'OfficeRibbonXEditor.exe'
project: 'OfficeRibbonXEditor'

- script: >-
iscc build/install/setup.iss
/DVersionPrefix="$(VersionPrefix)"
/DInputFolder="../../src/OfficeRibbonXEditor/bin/$(buildConfiguration)/$(targetFramework)"
/DOutputFolder="../../src/OfficeRibbonXEditor/bin/Installer/$(targetFramework)"
displayName: Generate installer

- template: build/templates/copy-and-publish.yml
parameters:
displayName: '.NET Framework Installer'
fileName: 'OfficeRibbonXEditor.msi'
project: 'Installer'
fileName: 'OfficeRibbonXEditor.exe'
binFolder: 'Installer'

- job: NetCore
displayName: .NET Core
Expand Down Expand Up @@ -191,6 +198,19 @@ stages:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: '.NET Core Binaries (Unsigned)'

- script: >-
iscc build/install/setup.iss
/DVersionPrefix="$(VersionPrefix)"
/DInputFolder="../../src/OfficeRibbonXEditor/bin/$(buildConfiguration)/$(targetFramework)"
/DOutputFolder="../../src/OfficeRibbonXEditor/bin/Installer/$(targetFramework)"
displayName: Generate installer

- template: build/templates/copy-and-publish.yml
parameters:
displayName: '.NET Core Installer'
fileName: 'OfficeRibbonXEditor.exe'
binFolder: 'Installer'

- job: ReleaseScripts
displayName: Publish Release Scripts
steps:
Expand All @@ -209,21 +229,36 @@ stages:

- job: NetFrameworkExecutable
displayName: Sign .NET Framework Executable
workspace:
clean: all
steps:
- template: build/templates/sign-and-publish.yml
parameters:
artifactName: '.NET Framework Executable'

- job: NetFrameworkInstaller
displayName: Sign .NET Framework Installer
workspace:
clean: all
steps:
- template: build/templates/sign-and-publish.yml
parameters:
artifactName: '.NET Framework Installer'

- job: NetCoreBinaries
displayName: Sign .NET Core Binaries
workspace:
clean: all
steps:
- template: build/templates/sign-and-publish.yml
parameters:
artifactName: '.NET Core Binaries'

- job: NetCoreInstaller
displayName: Sign .NET Core Installer
workspace:
clean: all
steps:
- template: build/templates/sign-and-publish.yml
parameters:
artifactName: '.NET Core Installer'
6 changes: 5 additions & 1 deletion build/PreBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ Write-Host "Build ID is: $buildId"
Get-ChildItem "src/OfficeRibbonXEditor/OfficeRibbonXEditor.csproj" |
ForEach-Object {
$c = ($_ | Get-Content -encoding UTF8)
$c = $c -replace '(<VersionPrefix>\d+.\d+.\d+)\.(\d)(</VersionPrefix>)', "`$1.$buildId`$3"
$c = $c -replace '(<VersionPrefix>\d+\.\d+\.\d+)\.(\d)(</VersionPrefix>)', "`$1.$buildId`$3"
$joined = $c -join "`r`n"
$match = $c | Select-String -Pattern '<VersionPrefix>(\d+\.\d+\.\d+\.\d+)</VersionPrefix>'
Write-Host "Resulting project:`n$joined"
$version = $match.Matches.Groups[1].Value
Write-Host "Resulting version: $version"
Write-Host "##vso[task.setvariable variable=VersionPrefix;]$version"
[IO.File]::WriteAllText($_.FullName, $joined)
}
146 changes: 146 additions & 0 deletions build/install/setup.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@

// This needs to coincide with the GUID of the original Wix project for previous versions
// to get uninstalled automatically
#define ProjectGuid "{{414e2267-764a-4e61-aa5e-f25f407dfafd}"

#define AssemblyName "Office RibbonX Editor"
#define Authors "Fernando Andreu"
#define ProjectUrl "https://github.com/fernandreu/office-ribbonx-editor"
#define Description "A tool to edit the Custom UI part of Office documents."
#define Copyright "Copyright (c) 2020 Fernando Andreu"
#define ExeName "OfficeRibbonXEditor.exe"
#define OutputFile "OfficeRibbonXEditor"

[Setup]
AppId={#ProjectGuid}
AppName={#AssemblyName}
AppVersion={#VersionPrefix}
AppVerName={#AssemblyName}
AppPublisher={#Authors}
AppPublisherURL={#ProjectUrl}
AppSupportURL={#ProjectUrl}
AppUpdatesURL={#ProjectUrl}
DefaultDirName={autopf}\{#AssemblyName}
DefaultGroupName={#AssemblyName}
DisableProgramGroupPage=no
DisableDirPage=auto
LicenseFile=..\..\LICENSE
Compression=lzma
SolidCompression=yes
WizardStyle=modern
VersionInfoVersion={#VersionPrefix}
VersionInfoDescription={#Description}
VersionInfoTextVersion={#VersionPrefix}
VersionInfoCopyright={#Copyright}
PrivilegesRequired=admin
OutputDir={#OutputFolder}
OutputBaseFilename={#OutputFile}
UninstallDisplayIcon={app}\{#ExeName}
AllowNoIcons=yes

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"

[Files]
Source: "{#InputFolder}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs

[Icons]
Name: "{group}\{#AssemblyName}"; Filename: "{app}\{#ExeName}"
Name: "{commondesktop}\{#AssemblyName}"; Filename: "{app}\{#ExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#ExeName}"; Description: "Launch application"; Flags: postinstall nowait skipifsilent unchecked

[Code]

function ProcessUninstallPath(Path: String): String;
var
sRet: String;
sUnInstPath: String;
begin
sUnInstPath := ExpandConstant(Path);
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sRet) then
RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sRet);
Result:=sRet;
end;

function GetUninstallString(Guid: String): String;
var
sRet : String;
begin
sRet := '';
if sRet = '' then sRet := ProcessUninstallPath('SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' + Guid);
if sRet = '' then sRet := ProcessUninstallPath('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + Guid);
if sRet = '' then sRet := ProcessUninstallPath('SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' + Guid + '_is1');
if sRet = '' then sRet := ProcessUninstallPath('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + Guid + '_is1');
Result:=sRet;
end;

function StrSplit(Text: String; Separator: String): TArrayOfString;
var
i, p: Integer;
Dest: TArrayOfString;
begin
i := 0;
repeat
SetArrayLength(Dest, i+1);
p := Pos(Separator,Text);
if p > 0 then begin
Dest[i] := Copy(Text, 1, p-1);
Text := Copy(Text, p + Length(Separator), Length(Text));
i := i + 1;
end else begin
Dest[i] := Text;
Text := '';
end;
until Length(Text)=0;
Result := Dest
end;

function UnInstallOldVersion(Guid: String): Integer;
var
sUnInstallString: String;
sParts: TArrayOfString;
sArgs: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString

// default return value
Result := 0;

// get the uninstall string of the old app
sUnInstallString := GetUninstallString(Guid);
if sUnInstallString <> '' then begin
sParts := StrSplit(sUnInstallString, '"');
sUnInstallString := RemoveQuotes(sParts[1]);
if CompareText(sUninstallString, 'MsiExec.exe') = 0 then
sArgs := '/QUIET /PASSIVE'
else
sArgs := '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES';
if Length(sParts) > 2 then sArgs := sArgs + sParts[2];
if Exec(sUnInstallString, sArgs,'', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then begin
// Attempt to uninstall all previous release versions
UnInstallOldVersion('{{40AA9F04-AA99-4F5A-A883-30ECBD75D60D}'); //1.1.0
UnInstallOldVersion('{{3AAD5FAB-246D-4EF6-8A52-B177281C31F0}'); //1.2.0
UnInstallOldVersion('{{9A16BB52-0C41-498F-95B7-A1D81CBB3693}'); //1.3.0
UnInstallOldVersion('{{61E6E348-06D4-42C3-8334-62ED500E6B73}'); //1.4.0
UnInstallOldVersion('{{59D5E1A2-B8EF-4252-A0F4-8EE644C9ADC9}'); //1.5.0
UnInstallOldVersion('{{64D3EECC-2267-4AB2-A8A3-4530B38768C3}'); //1.5.1
UnInstallOldVersion('{{E15B8EBB-C04E-4537-8187-C626529EEBEA}'); //1.6.0
UnInstallOldVersion('{#ProjectGuid}'); //1.6.* and above
end;
end;
4 changes: 2 additions & 2 deletions build/templates/copy-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
parameters:
displayName: '.NET Framework Executable'
fileName: 'OfficeRibbonXEditor.exe'
project: 'OfficeRibbonXEditor'
binFolder: '$(buildConfiguration)'

steps:
- task: CopyFiles@2
displayName: 'Copy ${{ parameters.displayName }}'
inputs:
sourceFolder: ''
contents: |
src/${{ parameters.project }}/bin/$(buildConfiguration)/$(targetFramework)/${{ parameters.fileName }}
src/OfficeRibbonXEditor/bin/${{ parameters.binFolder }}/$(targetFramework)/${{ parameters.fileName }}
targetFolder: '$(Build.ArtifactStagingDirectory)'
cleanTargetFolder: true # Optional
flattenFolders: true # Optional
Expand Down
49 changes: 0 additions & 49 deletions src/Installer/Installer.wixproj

This file was deleted.

Loading