Migrate to SDK-style net9.0-windows#1
Merged
Merged
Conversation
.NET Framework 4.8.1 is terminal and forced build/resource friction (preserialized-resource incompatibility, a missing targeting pack, and no clean build without Visual Studio). Move to an SDK-style project targeting net9.0-windows; WPF and WinForms are both retained until the WinForms UI is retired. The scan/delete engine and every P/Invoke struct are unchanged. Two runtime-adaptation fixes were required: - Directory.GetAccessControl(path) was removed on modern .NET; use the DirectoryInfo.GetAccessControl() extension (same default ACL sections) in the deletion lock check. - Read the file version from Environment.ProcessPath / the embedded AssemblyFileVersion attribute instead of Assembly.Location, which is empty in a published single-file bundle and crashed -version and -json. Drop packages.config and app.config (DPI awareness stays in app.manifest; no binding redirects are needed). RED.Tests retargets to net9.0-windows and references the engine project directly; the 50-test suite and the headless safety smoke pass unchanged.
The SDK-style project no longer needs Visual Studio / MSBuild. Replace the setup-msbuild + msbuild steps with dotnet build and keep the dotnet test and headless safety-smoke steps. The smoke now creates its junction with New-Item -ItemType Junction (no cmd dependency); RED+.exe writes to the piped stdout that the existing Tee-Object capture asserts on.
Publish with dotnet (-p:PublishSingleFile=true --self-contained) so the release needs no .NET runtime installed on the target machine, preserving RED++'s unzip-and-run portability. WPF and reflection-based resource loading are not trim-safe, so trimming is left off. A safety smoke runs against the published artifact before the release is created, so a build that fails the reparse-point / deny-ACL / AutoProtectRoot invariants cannot ship. The winget manifest architecture moves x86 -> x64 to match the published artifact, and publish/ is gitignored.
System Requirements no longer list .NET Framework 4.8.1: the release is a self-contained single-file build that bundles .NET 9, so there is nothing to install. Record the migration under the Unreleased changelog section.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates RED++ from .NET Framework 4.8.1 (old-style csproj +
packages.config) to an SDK-style project targetingnet9.0-windows(WPF + WinForms retained until the WinForms UI is retired). Zero behavior change to the verified scan/delete engine — every P/Invoke struct and safety invariant is untouched.Why
4.8.1 is terminal and forced build/resource friction: a preserialized-resource incompatibility, a missing targeting pack, and no clean build without Visual Studio. The net481 SDK workaround even left the GUI unlaunchable locally (a
FileLoadExceptiononiconProject). Modern .NET fixes all of that and unlocks a genuine self-contained single-file publish.What changed
RED/RED+.csprojrewritten asMicrosoft.NET.Sdk(net9.0-windows,UseWPF/UseWindowsForms, glob compile).GenerateAssemblyInfo=falsekeepsAssemblyInfo.csas the single version source. Output stays at repo-rootbin\<Config>\RED+.exe(no TFM subfolder) so CI/tooling paths are unchanged.packages.configandapp.config(DPI awareness stays inapp.manifestPerMonitorV2; no binding redirects needed).RED.Testsretargeted tonet9.0-windowswith a directProjectReference(was a HintPath to the MSBuild-built exe);InternalsVisibleTopreserved.Directory.GetAccessControl(path)→DirectoryInfo.GetAccessControl()(removed static; same default ACL sections) in the deletion lock check.Environment.ProcessPath/ theAssemblyFileVersionattribute instead ofAssembly.Location— the latter is empty in a single-file bundle and crashed-version/-json(caught by smoking the published artifact).ci.yml): MSBuild →dotnet build/dotnet test; safety smoke retained.release.yml):dotnet publishself-contained single-filewin-x64(no runtime install needed), with a pre-release safety smoke gate on the published artifact. winget manifest archx86→x64.Verification
dotnet build -c Release— clean, no targeting-pack hacks, no preserialized-resource workarounds.dotnet test— 50/50 pass on the new TFM (incl. the USN/MFT parser bounds tests that lock the P/Invoke offsets).-classic) in dark + light; Extras menu enumerated via UI Automation.-version+ GUI render from the bundle.Safety-critical change to a file-deleting tool — reviewed as a unit; the engine and its tests are unchanged.