-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
242 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,4 +272,4 @@ projectfiles.tar | |
|
||
global.json | ||
.nuke/temp | ||
.nuke/temp | ||
.nuke/build.schema.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Application x:Class="DemoApp.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:DemoApp" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace DemoApp | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<Nullable>enable</Nullable> | ||
<UseWPF>true</UseWPF> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<SelfContained>true</SelfContained> | ||
<IncludeNativeLibrariesInSingleFile>true</IncludeNativeLibrariesInSingleFile> | ||
<ApplicationIcon>app.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Window x:Class="DemoApp.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:DemoApp" | ||
mc:Ignorable="d" | ||
Title="InnoSetup ScriptBuilder Demo" Height="200" Width="330"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition/> | ||
<RowDefinition Height="30"/> | ||
</Grid.RowDefinitions> | ||
<Label Grid.Row="0" Content="Demo" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" /> | ||
<Button Grid.Row="1" Width="50" Content="Close" HorizontalAlignment="Right" Click="CloseButtonOnClick" Margin="0 0 5 5"/> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace DemoApp | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void CloseButtonOnClick(object sender, RoutedEventArgs e) | ||
{ | ||
Close(); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.IO; | ||
using Bimlab.Nuke.Components; | ||
using InnoSetup.ScriptBuilder; | ||
using Nuke.Common; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.Tooling; | ||
using Nuke.Common.Tools.DotNet; | ||
using Nuke.Common.Tools.InnoSetup; | ||
|
||
partial class Build | ||
{ | ||
Target BuildScript => _ => _ | ||
.Description("Builds an iss script file.") | ||
.Executes(() => | ||
{ | ||
var programFiles = (RelativePath)InnoConstants.ProgramFiles64; | ||
var group = (RelativePath)InnoConstants.Group; | ||
var appDir = (RelativePath)InnoConstants.App; | ||
|
||
BuilderUtils.Build(builder => | ||
{ | ||
var now = DateTime.UtcNow; | ||
builder.Setup.Create("InnoSetup.ScriptBuilder Demo") | ||
.AppId("{{53A6910D-931A-4FD7-AAA3-DA94DCAD62B6}") | ||
.AppVersion("1.0.0") | ||
.DefaultDirName(programFiles / "IssBuilder Demo") | ||
.DefaultGroupName("InnoSetup ScriptBuilder Demo") | ||
.OutputBaseFilename($"InnoSetup.Builder.Demo_{now:yyyyMMdd}.{now:hhmm}") | ||
.ArchitecturesAllowed(Architectures.X64) | ||
.ArchitecturesInstallIn64BitMode(ArchitecturesInstallIn64BitMode.X64) | ||
.SolidCompression(YesNo.Yes) | ||
.Compression("lzma2") | ||
.DisableDirPage(YesNo.No) | ||
.DisableProgramGroupPage(YesNo.No); | ||
|
||
builder.Files | ||
.CreateEntry(OutputDir / "*", InnoConstants.App) | ||
.Flags(FileFlags.IgnoreVersion | FileFlags.RecurseSubdirs); | ||
|
||
builder.Icons | ||
.CreateEntry(group / "InnoSetup.ScriptBuilder Demo", appDir / "DemoApp.exe"); | ||
|
||
builder.Code.CreateEntry(File.ReadAllText(RootDirectory / "build" / "setup.pas")); | ||
}, IssPath); | ||
|
||
Console.WriteLine(File.ReadAllText(IssPath)); | ||
}); | ||
|
||
/// <summary> | ||
/// Run <code>.\build.cmd</code> in the solution folder to build Demo setup. | ||
/// </summary> | ||
Target BuildSetup => _ => _ | ||
.Description("Builds Demo application installation package.") | ||
.DependsOn(PublishDemoApp, BuildScript) | ||
.Executes(() => | ||
{ | ||
InnoSetupTasks.InnoSetup(config => config | ||
.SetProcessToolPath(ToolPathResolver.GetPackageExecutable("Tools.InnoSetup", "ISCC.exe")) | ||
.SetScriptFile(IssPath) | ||
.SetOutputDir(From<IPack>().ArtifactsDirectory)); | ||
}); | ||
|
||
Target PublishDemoApp => _ => _ | ||
.Description("Publishes Demo application.") | ||
.Executes(() => | ||
{ | ||
DotNetTasks.DotNetPublish(x => x | ||
.SetConfiguration("Release") | ||
.SetOutput(OutputDir) | ||
.SetProject(Solution.GetProject("DemoApp")!.Path)); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
function GetUninstallString(): String; | ||
var | ||
sUnInstPath: String; | ||
sUnInstallString: String; | ||
begin | ||
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); | ||
sUnInstallString := ''; | ||
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then | ||
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString); | ||
Result := sUnInstallString; | ||
end; | ||
|
||
function IsUpgrade(): Boolean; | ||
begin | ||
Result := (GetUninstallString() <> ''); | ||
end; | ||
|
||
function UnInstallOldVersion(): Integer; | ||
var | ||
sUnInstallString: 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(); | ||
if sUnInstallString <> '' then begin | ||
sUnInstallString := RemoveQuotes(sUnInstallString); | ||
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', 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 | ||
if (IsUpgrade()) then | ||
begin | ||
UnInstallOldVersion(); | ||
end; | ||
end; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters