CsCom 4.1.0

dotnet tool install --global CsCom --version 4.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local CsCom --version 4.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=CsCom&version=4.1.0
                    
nuke :add-package CsCom --version 4.1.0
                    

CsCom

The cscom .NET tool generates COM interop code from type libraries or existing .NET interop assemblies, similar to TlbImp. Unlike TlbImp, it does not rely on the built-in COM interop of .NET: the generated C# uses the source-generated COM interop of .NET, so it can be trimmed and compiled with Native AOT.

It needs Windows and the .NET 10 SDK or later.

Usage

dotnet tool install --global CsCom

# Generate a C# project with the interop code of a type library, by a file, a LIBID or a ProgID
cscom project create Scripting.Dictionary

# Or generate it during the build of an existing project, with the CsCom.Build package
cscom reference add Scripting.Dictionary

The generated code:

using Interop.Scripting;

IDictionary dictionary = Dictionary.Create();       // creates the COM object (CoCreateInstance)
dictionary.CompareMode = CompareMethod.TextCompare; // properties are C# 14 extension properties
dictionary.Add("apple", 3);                         // VARIANT parameters are object?
foreach (object? key in dictionary)                 // _NewEnum, through IEnumVARIANT
{
    Console.WriteLine(key);
}

cscom assembly build and cscom assembly pack build a ready-to-use interop assembly or NuGet package instead, and cscom list lists the types and members of a type library. cscom typelib export goes the other way, like TlbExp: it writes the type library of an assembly with [GeneratedComInterface] and [GeneratedComClass] types.

Documentation

See cscom.fedarovich.com, starting with Getting started, Commands and Exporting type libraries.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos 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.

This package has no dependencies.

Version Downloads Last Updated
4.1.0 109 11/25/2026
4.0.0 108 11/21/2026
4.0.0-rc.2 74 11/20/2026
4.0.0-rc.1 77 11/20/2026
3.0.0 111 11/13/2026
3.0.0-rc.1 67 11/13/2026
3.0.0-beta.2 67 11/13/2026
3.0.0-beta.1 66 11/13/2026
3.0.0-alpha1 98 11/12/2026
2.0.0 108 11/11/2026
2.0.0-beta.1 67 11/10/2026
2.0.0-alpha.1 88 11/2/2026
1.0.0 126 10/30/2026
1.0.0-beta.3 73 10/29/2026
1.0.0-beta.2 78 10/28/2026
1.0.0-beta.1 83 10/28/2026