Majorsilence.Forms.WindowsFormsInterop
26.0.52
dotnet add package Majorsilence.Forms.WindowsFormsInterop --version 26.0.52
NuGet\Install-Package Majorsilence.Forms.WindowsFormsInterop -Version 26.0.52
<PackageReference Include="Majorsilence.Forms.WindowsFormsInterop" Version="26.0.52" />
<PackageVersion Include="Majorsilence.Forms.WindowsFormsInterop" Version="26.0.52" />
<PackageReference Include="Majorsilence.Forms.WindowsFormsInterop" />
paket add Majorsilence.Forms.WindowsFormsInterop --version 26.0.52
#r "nuget: Majorsilence.Forms.WindowsFormsInterop, 26.0.52"
#:package Majorsilence.Forms.WindowsFormsInterop@26.0.52
#addin nuget:?package=Majorsilence.Forms.WindowsFormsInterop&version=26.0.52
#tool nuget:?package=Majorsilence.Forms.WindowsFormsInterop&version=26.0.52
Majorsilence.Forms.WindowsFormsInterop
Migrate a WinForms application one screen at a time, instead of all at once.
A Windows-only bridge that lets real System.Windows.Forms forms and
Majorsilence.Forms forms live in the same
process, in both directions. On Windows, Avalonia's Win32 backend shares the existing Win32 message
pump, so both toolkits are serviced by a single Application.Run — no second thread and no second
message loop.
That makes an incremental migration practical: port the screens that matter, keep the rest on real WinForms, and ship working software the whole way through. When every screen is over, drop this package and the app is cross-platform.
Windows-only by definition — System.Windows.Forms does not exist on macOS or Linux. Off Windows it
builds as an empty placeholder assembly so a cross-platform solution still compiles everywhere;
calls throw PlatformNotSupportedException at runtime.
Install
dotnet add package Majorsilence.Forms.WindowsFormsInterop
Direction A — open a legacy WinForms form from a Majorsilence.Forms app
using Majorsilence.Forms.Interop;
WindowsFormsInterop.Show (new LegacyReportForm ()); // modeless
var result = WindowsFormsInterop.ShowDialog (new LegacySettingsForm ());
Direction B — open a Majorsilence.Forms form from an existing WinForms app
Call InitializeMajorsilence() once in Program.Main, after WinForms initializes:
using Majorsilence.Forms.Interop;
WindowsFormsInterop.InitializeMajorsilence ();
// … later, from a WinForms event handler:
WindowsFormsInterop.ShowMajorsilenceForm (new NewDashboardForm ());
Call these on the UI (STA) thread. From a background thread, marshal first:
Majorsilence.Forms.Application.RunOnUIThread (() => WindowsFormsInterop.Show (form));
Links
- Migration guide — the
majorsilence-migrateCLI and the--dual-buildpath, the other way to migrate incrementally - WinForms interop reference
- Documentation
- Repository
Licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Majorsilence.Forms (>= 26.0.52)
-
net8.0-windows7.0
- Majorsilence.Forms (>= 26.0.52)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.