Upgrade to .NET 8 LTS and enhance installer functionality

- Upgraded from .NET 7 to .NET 8 LTS for better Windows 11 compatibility
- Added App.config with runtime switches to prevent DirectWrite crashes
- Moved software rendering initialization to App() constructor
- Disabled ReadyToRun compilation to avoid font rendering issues
- Enhanced installer with auto-launch after installation
- Removed license agreement screen from installer
- Added WiX heat.exe file harvesting for proper multi-file deployment
- Cleaned up old MSI files from repository

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-07 09:30:21 -08:00
parent cff9bc4876
commit 0eef9a63d3
7 changed files with 59 additions and 13 deletions

View File

@@ -20,6 +20,15 @@
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
<Property Id="MSIINSTALLPERUSER" Value="1" />
<!-- Launch application after installation -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch NFC Actions" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<Property Id="WixShellExecTarget" Value="[#NfcActionsExe]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
<Icon Id="ProductIcon" SourceFile="..\NfcActions\Resources\icon.ico" />
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
<Property Id="ARPHELPLINK" Value="https://dangerousthings.com" />
@@ -32,6 +41,21 @@
<ComponentRef Id="AutoStartRegistry" />
</Feature>
<UI>
<!-- Use WixUI_Minimal without license page -->
<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<!-- Skip the license page -->
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="LocalAppDataFolder">
<Directory Id="CompanyFolder" Name="DangerousThings">

Binary file not shown.

7
NfcActions/App.config Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<!-- Force software rendering to prevent DirectWrite crashes -->
<AppContextSwitchOverrides value="Switch.System.Windows.DoNotUsePresentationDpiCapabilityTier2OrGreater=true;Switch.System.Windows.DoNotScaleForDpiChanges=false" />
</runtime>
</configuration>

View File

@@ -25,6 +25,24 @@ public partial class App : Application
private LogService? _logService;
private MainViewModel? _viewModel;
public App()
{
// CRITICAL: Set software rendering mode BEFORE any WPF initialization
// This must be done in the constructor before InitializeComponent()
try
{
// Set environment variable as additional safeguard
Environment.SetEnvironmentVariable("DOTNET_SYSTEM_WINDOWS_DONOTUSEPRESENTATIONDPICAPABILITYTIER2ORGREATER", "1");
// Force software rendering
RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
}
catch
{
// If this fails, try to continue anyway
}
}
private void Application_Startup(object sender, StartupEventArgs e)
{
// Ensure only one instance runs at a time
@@ -41,15 +59,6 @@ public partial class App : Application
return;
}
// Workaround for DirectWrite crash - force software rendering
try
{
RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
}
catch
{
// Ignore if this fails
}
// Initialize services
_logService = new LogService();
_cardReaderService = new CardReaderService(_logService);

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
@@ -20,7 +20,7 @@
<PublishSingleFile>false</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRun>false</PublishReadyToRun>
<PublishTrimmed>false</PublishTrimmed>
<EnableCompressionInSingleFile>false</EnableCompressionInSingleFile>
</PropertyGroup>

View File

@@ -9,7 +9,7 @@ param(
$ErrorActionPreference = "Stop"
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
$projectPath = Join-Path $scriptPath "NfcActions\NfcActions.csproj"
$publishPath = Join-Path $scriptPath "NfcActions\bin\Release\net7.0-windows\win-x64\publish"
$publishPath = Join-Path $scriptPath "NfcActions\bin\Release\net8.0-windows\win-x64\publish"
$installerPath = Join-Path $scriptPath "Installer"
Write-Host "=== NFC Actions Release Build ===" -ForegroundColor Cyan
@@ -83,6 +83,12 @@ if ($BuildInstaller) {
exit 1
}
# Update the harvested file to set ID to NfcActions.exe
Write-Host " Setting file ID for NfcActions.exe..." -ForegroundColor Gray
$harvestedContent = Get-Content obj\HarvestedFiles.wxs -Raw
$harvestedContent = $harvestedContent -replace '(<File Id=")([^"]+)(" KeyPath="yes" Source="\$\(var\.PublishDir\)\\NfcActions\.exe")', '$1NfcActionsExe$3'
Set-Content obj\HarvestedFiles.wxs -Value $harvestedContent
# Run candle (compile) on both wxs files
Write-Host " Compiling installer..." -ForegroundColor Gray
& candle.exe Product.wxs obj\HarvestedFiles.wxs "-dPublishDir=$publishPath" -out obj\ -arch x64
@@ -94,7 +100,7 @@ if ($BuildInstaller) {
# Run light (link)
Write-Host " Linking MSI package..." -ForegroundColor Gray
& light.exe obj\Product.wixobj obj\HarvestedFiles.wixobj -out bin\NfcActions-Setup.msi -ext WixUIExtension -sval
& light.exe obj\Product.wixobj obj\HarvestedFiles.wixobj -out bin\NfcActions-Setup.msi -ext WixUIExtension -ext WixUtilExtension -sval
if ($LASTEXITCODE -ne 0) {
Pop-Location
Write-Host "Light (WiX link) failed!" -ForegroundColor Red