WinFormsComInterop 0.5.0

dotnet add package WinFormsComInterop --version 0.5.0                
NuGet\Install-Package WinFormsComInterop -Version 0.5.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WinFormsComInterop" Version="0.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WinFormsComInterop --version 0.5.0                
#r "nuget: WinFormsComInterop, 0.5.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WinFormsComInterop as a Cake Addin
#addin nuget:?package=WinFormsComInterop&version=0.5.0

// Install WinFormsComInterop as a Cake Tool
#tool nuget:?package=WinFormsComInterop&version=0.5.0                

ComWrappers required to run NativeAOT and WinForms

This repository has ComWrappers implementation for WinForms. In additional to that, it allow use WinForms and NativeAOT and R2R with trimming together.

Getting started

Just add WinFormsComInterop to your project.

dotnet add package WinFormsComInterop

Then to your Program.cs add following line

ComWrappers.RegisterForMarshalling(WinFormsComInterop.WinFormsComWrappers.Instance);

And modify project file to enable NativeAOT

<PublishAot>true</PublishAot>
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>

If you application will works with this ComWrappers implementation, then most likely it would work with NativeAOT.

If you are using WebView2 using Microsoft.Web.WebView2.Core package, then use

ComWrappers.RegisterForMarshalling(WinFormsComInterop.WebView2.WebView2ComWrapper.Instance);

Also

  1. Add <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1462.37" /> as depedency. This library would work only starting from this version of WebView2 package.
  2. Add RD.xml file from https://github.com/kant2002/RdXmlLibrary/blob/main/Microsoft.AspNetCore.Components.Web.rd.xml to project
  3. Add <RdXmlFile Include="Microsoft.AspNetCore.Components.Web.rd.xml" /> to project file
  4. Make sure that RootComponets are added to you app-specific rd.xml
<?xml version="1.0" encoding="utf-8" ?>
<Directives>
  <Application>
    <Assembly Name="YourAppAssembly" Dynamic="Required All">
      <Type Name="YourAppAssembly.YourRootComponent" Dynamic="Required All" />
    </Assembly>
  </Application>
</Directives>
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on WinFormsComInterop:

Repository Stars
AntdUI/AntdUI
👚 基于 Ant Design 设计语言的 Winform 界面库
Version Downloads Last updated
0.5.0 6,588 6/16/2024
0.4.3 4,505 1/18/2023
0.4.2 438 12/23/2022
0.4.1 330 12/23/2022
0.4.0 307 12/23/2022
0.3.2 2,459 10/23/2022
0.3.1 401 10/23/2022
0.3.0 485 9/3/2022
0.2.9 723 7/21/2021
0.2.8 459 7/15/2021
0.2.7 335 7/11/2021
0.2.6 317 6/17/2021
0.2.5 323 6/15/2021
0.2.4 353 6/11/2021
0.2.3 330 6/9/2021
0.2.2 317 6/4/2021
0.2.1 376 6/4/2021
0.2.0 342 6/3/2021
0.1.0 395 5/29/2021