Browse Source

Merge pull request #3456 from icsharpcode/feature/wixsharp

Update to _wix4 packages for installer
pull/3387/merge
Christoph Wille 3 months ago committed by GitHub
parent
commit
5428a9b53a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  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
  6. 16
      publishlocaldev.ps1

3
.github/workflows/build-ilspy.yml

@ -46,6 +46,9 @@ jobs:
- name: Install dotnet-format - 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 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 - name: Get Version
id: version id: version
shell: pwsh shell: pwsh

15
ILSpy.Installer/ILSpy.Installer.csproj

@ -15,10 +15,21 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="WixSharp" Version="1.26.0" /> <None Remove="*.msi" />
<PackageReference Include="WixSharp.wix.bin" Version="3.14.1" /> <None Remove="*.exe" />
<None Remove="*.wxs" />
<None Remove="*.wixpdb" />
<None Remove="*.wixobj" />
</ItemGroup> </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> <ItemGroup>
<ProjectReference Include="..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj" /> <ProjectReference Include="..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj" />
</ItemGroup> </ItemGroup>

14
ILSpy.Installer/README.md

@ -1,5 +1,19 @@
# Building the Installer # 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 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
project.GUID = new Guid("a12fdab1-731b-4a98-9749-d481ce8692ab"); project.GUID = new Guid("a12fdab1-731b-4a98-9749-d481ce8692ab");
project.Version = AppPackage.Version; project.Version = AppPackage.Version;
project.SourceBaseDir = Path.GetDirectoryName(Environment.CurrentDirectory); project.SourceBaseDir = Path.GetDirectoryName(Environment.CurrentDirectory);
project.InstallScope = InstallScope.perUser; project.Scope = InstallScope.perUser;
project.InstallPrivileges = InstallPrivileges.limited;
project.ControlPanelInfo.ProductIcon = @"..\ILSpy\Images\ILSpy.ico"; project.ControlPanelInfo.ProductIcon = @"..\ILSpy\Images\ILSpy.ico";
project.ControlPanelInfo.Manufacturer = "ICSharpCode Team"; project.ControlPanelInfo.Manufacturer = "ICSharpCode Team";
project.LocalizationFile = Path.Combine(Environment.CurrentDirectory, "winui.wxl"); project.LocalizationFile = Path.Combine(Environment.CurrentDirectory, "winui.wxl");
@ -71,41 +70,7 @@ namespace ILSpy.Installer
new FileShortcut("ILSpy", @"%ProgramMenu%") new FileShortcut("ILSpy", @"%ProgramMenu%")
}; };
Compiler.WixLocation = GetWixBinLocationForPackage();
Compiler.BuildMsi(project, Path.Combine(Environment.CurrentDirectory, "wix", $"ILSpy-{AppPackage.Version}-{buildPlatform}.msi")); 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 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<WixLocalization Culture="en-US" xmlns="http://schemas.microsoft.com/wix/2006/localization"> <WixLocalization Culture="en-US" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<String Id="VerifyReadyDlgInstallText" Overridable="yes">Click Install to begin the installation. Click Cancel to exit the wizard. <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>
ILSpy will be installed for current user into following directory:
[INSTALLDIR]
</String>
</WixLocalization> </WixLocalization>

16
publishlocaldev.ps1

@ -1,13 +1,13 @@
# For local development of the VSIX package - build and publish (VS2022 also needs arm64) # For local development of the VSIX package - build and publish (VS2022 also needs arm64)
$output_x64 = "./ILSpy/bin/Debug/net8.0-windows/win-x64/publish/fwdependent" $output_x64 = "./ILSpy/bin/Release/net8.0-windows/win-x64/publish/fwdependent"
dotnet publish ./ILSpy/ILSpy.csproj -c Debug --no-restore --no-self-contained -r win-x64 -o $output_x64 dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --no-self-contained -r win-x64 -o $output_x64
dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Debug --no-restore --no-self-contained -r win-x64 -o $output_x64 dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --no-self-contained -r win-x64 -o $output_x64
dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Debug --no-restore --no-self-contained -r win-x64 -o $output_x64 dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Release --no-restore --no-self-contained -r win-x64 -o $output_x64
$output_arm64 = "./ILSpy/bin/Debug/net8.0-windows/win-arm64/publish/fwdependent" $output_arm64 = "./ILSpy/bin/Release/net8.0-windows/win-arm64/publish/fwdependent"
dotnet publish ./ILSpy/ILSpy.csproj -c Debug --no-restore --no-self-contained -r win-arm64 -o $output_arm64 dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o $output_arm64
dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Debug --no-restore --no-self-contained -r win-arm64 -o $output_arm64 dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o $output_arm64
dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Debug --no-restore --no-self-contained -r win-arm64 -o $output_arm64 dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o $output_arm64
Loading…
Cancel
Save