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" />
                    
Directory.Packages.props
<PackageReference Include="Bluehill.NativeCom" />
                    
Project file
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
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=Bluehill.NativeCom&version=1.0.3
                    
Install as a Cake Tool

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 implements IClassFactory.
  • Bluehill.NativeCom.DllHelper: A class that helps implement DllGetClassObject and IClassFactory.
  • Bluehill.NativeCom.IClassFactory: The COM IClassFactory interface.
  • Source generator that automatically generates class factory class, DllGetClassObject and DllCanUnloadNow

How to use

  1. Create a class library project targeting .NET 8 or higher.
  2. Make sure you are using C# 11 or higher. .NET 8 and higher use C# 12 and higher by default.
  3. Add this package and Bluehill.NativeCom.SourceGenerator package to your project.
  4. Enable native AOT publishing and unsafe code by modifying your project file as follows:
    <PropertyGroup>
      <PublishAot>true</PublishAot>
      <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    </PropertyGroup>
    
  5. 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)].
  6. Automatically generate a factory and DllGetClassObject and DllCanUnloadNow using the ClassFactory attribute as follows:
    [GeneratedComClass]
    [ClassFactory<Implementation>]
    public partial class MyClassFactory : IClassFactory;
    
  7. Run dotnet publish. You will find the COM server DLL in the native folder of your publish folder!
Product 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.

Version Downloads Last Updated
1.0.3 129 7/16/2025
1.0.2 132 7/10/2025
1.0.1 132 7/9/2025