Switch to .NET 8 for cross-platform build support

- Target net8.0-windows instead of net4.8
- EnableWindowsTargeting for Linux build
- Replace Marshal.GetActiveObject with P/Invoke (not in .NET 8)
- Use NuGet package for Outlook Interop instead of local DLL ref
- Update Inno Setup script for .NET 8 runtime check
- Builds successfully on Linux, runs on Windows

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 10:33:21 +02:00
parent 84ba78a1c5
commit ad649ad319
4 changed files with 41 additions and 28 deletions
+20 -11
View File
@@ -36,7 +36,7 @@ Name: "autostart"; Description: "Bei Windows-Anmeldung automatisch starten"; Gro
[Files]
; Hauptanwendung - Pfad anpassen nach Build
Source: "..\src\StarfaceOutlookSync\bin\Release\net4.8\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\src\StarfaceOutlookSync\bin\Release\net8.0-windows\win-x64\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
@@ -57,26 +57,35 @@ Filename: "taskkill"; Parameters: "/F /IM {#MyAppExeName}"; Flags: runhidden; Ru
Type: filesandordirs; Name: "{userappdata}\StarfaceOutlookSync"
[Code]
// Pruefe ob .NET Framework 4.8 installiert ist
function IsDotNetInstalled(): Boolean;
// Pruefe ob .NET 8 Desktop Runtime installiert ist
function IsDotNet8Installed(): Boolean;
var
Version: Cardinal;
ResultCode: Integer;
begin
Result := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', Version);
// dotnet --list-runtimes enthaelt "Microsoft.WindowsDesktop.App 8.x"
Result := Exec('dotnet', '--list-runtimes', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
if Result then
Result := Version >= 528040; // .NET 4.8
Result := ResultCode = 0;
// Einfacher Check: dotnet.exe muss existieren
Result := FileExists(ExpandConstant('{commonpf}\dotnet\dotnet.exe')) or
FileExists(ExpandConstant('{commonpf64}\dotnet\dotnet.exe'));
end;
function InitializeSetup(): Boolean;
begin
Result := True;
if not IsDotNetInstalled() then
if not IsDotNet8Installed() then
begin
MsgBox('.NET Framework 4.8 oder hoeher wird benoetigt.' + #13#10 +
'Bitte installieren Sie es von:' + #13#10 +
'https://dotnet.microsoft.com/download/dotnet-framework/net48',
mbError, MB_OK);
if MsgBox('.NET 8 Desktop Runtime wird benoetigt.' + #13#10 + #13#10 +
'Soll die Download-Seite geoeffnet werden?',
mbConfirmation, MB_YESNO) = IDYES then
begin
ShellExec('open', 'https://dotnet.microsoft.com/download/dotnet/8.0/runtime', '', '', SW_SHOWNORMAL, ewNoWait, ResultCode);
end;
Result := False;
end;
end;
var
ResultCode: Integer;