Browse Source

Update to _wix4 packages for installer

pull/3456/head
Christoph Wille 3 weeks ago
parent
commit
01f296fed8
  1. 3
      .github/workflows/build-ilspy.yml
  2. 15
      ILSpy.Installer/ILSpy.Installer.csproj
  3. 14
      ILSpy.Installer/README.md
  4. 37
      ILSpy.Installer/setup.cs
  5. 10
      ILSpy.Installer/winui.wxl

3
.github/workflows/build-ilspy.yml

@ -46,6 +46,9 @@ jobs: @@ -46,6 +46,9 @@ jobs:
- name: Install dotnet-format
run: dotnet tool install -g dotnet-format --version "8.3.546805" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
- name: Install wix (locked version)
run: dotnet tool install --global wix --version 6.0.0
- name: Get Version
id: version
shell: pwsh

15
ILSpy.Installer/ILSpy.Installer.csproj

@ -15,10 +15,21 @@ @@ -15,10 +15,21 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixSharp" Version="1.26.0" />
<PackageReference Include="WixSharp.wix.bin" Version="3.14.1" />
<None Remove="*.msi" />
<None Remove="*.exe" />
<None Remove="*.wxs" />
<None Remove="*.wixpdb" />
<None Remove="*.wixobj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixSharp_wix4" Version="2.6.1" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="cd .\&#xD;&#xA;set ide=true&#xD;&#xA;&quot;$(TargetPath)&quot;" />
</Target>
<ItemGroup>
<ProjectReference Include="..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj" />
</ItemGroup>

14
ILSpy.Installer/README.md

@ -1,5 +1,19 @@ @@ -1,5 +1,19 @@
# Building the Installer
## Dependencies
See https://github.com/oleg-shilo/wixsharp/wiki#dependencies
```
dotnet tool install --global wix
```
GitHub runners installed software https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md at time
of writing WiX Toolset 3.14.1.8722
## ILSpy Binaries
It is mandatory to first publish(.ps1) the respective target platforms, then setup can be built, eg
```

37
ILSpy.Installer/setup.cs

@ -45,8 +45,7 @@ namespace ILSpy.Installer @@ -45,8 +45,7 @@ namespace ILSpy.Installer
project.GUID = new Guid("a12fdab1-731b-4a98-9749-d481ce8692ab");
project.Version = AppPackage.Version;
project.SourceBaseDir = Path.GetDirectoryName(Environment.CurrentDirectory);
project.InstallScope = InstallScope.perUser;
project.InstallPrivileges = InstallPrivileges.limited;
project.Scope = InstallScope.perUser;
project.ControlPanelInfo.ProductIcon = @"..\ILSpy\Images\ILSpy.ico";
project.ControlPanelInfo.Manufacturer = "ICSharpCode Team";
project.LocalizationFile = Path.Combine(Environment.CurrentDirectory, "winui.wxl");
@ -71,41 +70,7 @@ namespace ILSpy.Installer @@ -71,41 +70,7 @@ namespace ILSpy.Installer
new FileShortcut("ILSpy", @"%ProgramMenu%")
};
Compiler.WixLocation = GetWixBinLocationForPackage();
Compiler.BuildMsi(project, Path.Combine(Environment.CurrentDirectory, "wix", $"ILSpy-{AppPackage.Version}-{buildPlatform}.msi"));
}
// Copied from https://github.com/oleg-shilo/wixsharp/blob/c4f8615ce8e47c7162edb30656669d0d326f79ff/Source/src/WixSharp/Utilities/WixBinLocator.cs#L117
private static string GetWixBinLocationForPackage()
{
//The global packages may be redirected with environment variable
//https://docs.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders
string wixBinPackageDir;
var nugetPackagesEnvironmentVariable = Environment.GetEnvironmentVariable("NUGET_PACKAGES");
if (nugetPackagesEnvironmentVariable.IsNotEmpty() && Directory.Exists(nugetPackagesEnvironmentVariable))
{
wixBinPackageDir = Path.Combine(nugetPackagesEnvironmentVariable, "wixsharp.wix.bin");
}
else
{
wixBinPackageDir = @"%userprofile%\.nuget\packages\wixsharp.wix.bin".ExpandEnvVars();
}
if (Directory.Exists(wixBinPackageDir))
{
Version greatestWixBinVersion = System.IO.Directory.GetDirectories(wixBinPackageDir)
.Select(dirPath => new Version(dirPath.PathGetFileName()))
.OrderDescending()
.FirstOrDefault();
if (greatestWixBinVersion != null)
{
return wixBinPackageDir.PathJoin(greatestWixBinVersion.ToString(), @"tools\bin");
}
}
return "";
}
}
}

10
ILSpy.Installer/winui.wxl

@ -1,10 +1,4 @@ @@ -1,10 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<WixLocalization Culture="en-US" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="VerifyReadyDlgInstallText" Overridable="yes">Click Install to begin the installation. Click Cancel to exit the wizard.
ILSpy will be installed for current user into following directory:
[INSTALLDIR]
</String>
<WixLocalization Culture="en-US" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<String Id="VerifyReadyDlgInstallText" Overridable="yes" Value="Click Install to begin the installation. Click Cancel to exit the wizard.&#xD;&#xA;&#x9;&#xD;&#xA;&#x9;ILSpy will be installed for current user into following directory:&#xD;&#xA;&#x9;&#xD;&#xA;&#x9;[INSTALLDIR]"></String>
</WixLocalization>
Loading…
Cancel
Save