Bluehill.NativeCom
1.0.3
dotnet add package Bluehill.NativeCom --version 1.0.3
NuGet\Install-Package Bluehill.NativeCom -Version 1.0.3
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="Bluehill.NativeCom" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bluehill.NativeCom" Version="1.0.3" />
<PackageReference Include="Bluehill.NativeCom" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bluehill.NativeCom --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bluehill.NativeCom, 1.0.3"
#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.
#:package Bluehill.NativeCom@1.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bluehill.NativeCom&version=1.0.3
#tool nuget:?package=Bluehill.NativeCom&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bluehill.NativeCom
A package to help create native in-process COM servers (DLLs) using native AOT. This can be used to create in-process COM servers, such as shell extensions.
What's included?
Bluehill.NativeCom.ClassFactoryAttribute
: Attribute indicating that a class implementsIClassFactory
.Bluehill.NativeCom.DllHelper
: A class that helps implementDllGetClassObject
andIClassFactory
.Bluehill.NativeCom.IClassFactory
: The COMIClassFactory
interface.- Source generator that automatically generates class factory class,
DllGetClassObject
andDllCanUnloadNow
How to use
- Create a class library project targeting .NET 8 or higher.
- Make sure you are using C# 11 or higher. .NET 8 and higher use C# 12 and higher by default.
- Add this package and
Bluehill.NativeCom.SourceGenerator
package to your project. - Enable native AOT publishing and unsafe code by modifying your project file as follows:
<PropertyGroup> <PublishAot>true</PublishAot> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup>
- Write the COM interfaces you want and the classes that implement them. Don't forget to use
[GeneratedComInterface]
and[GeneratedComClass]
instead of[ComImport]
and[ComVisible(true)]
. - Automatically generate a factory and
DllGetClassObject
andDllCanUnloadNow
using theClassFactory
attribute as follows:[GeneratedComClass] [ClassFactory<Implementation>] public partial class MyClassFactory : IClassFactory;
- Run
dotnet publish
. You will find the COM server DLL in thenative
folder of your publish folder!
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0-windows7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.