CsCom.Build 4.1.0

dotnet add package CsCom.Build --version 4.1.0
                    
NuGet\Install-Package CsCom.Build -Version 4.1.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="CsCom.Build" Version="4.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CsCom.Build" Version="4.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CsCom.Build" />
                    
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 CsCom.Build --version 4.1.0
                    
#r "nuget: CsCom.Build, 4.1.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.
#:package CsCom.Build@4.1.0
                    
#: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=CsCom.Build&version=4.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CsCom.Build&version=4.1.0
                    
Install as a Cake Tool

CsCom.Build

CsCom.Build generates COM interop code during the build of a project, from the type libraries, ProgIDs, LIBIDs and .NET interop assemblies that the project lists as CsComReference items. The generated C# uses the source-generated COM interop of .NET, so it can be trimmed and compiled with Native AOT. The package bundles the cscom tool, which generates the code.

It needs Windows, .NET 10 or later and C# 14 or later, and a Windows-specific target framework such as net10.0-windows.

Usage

cscom reference add Scripting.Dictionary adds the package and the reference to a project, or add them yourself:

<ItemGroup>
  <CsComReference Include="Scripting.Dictionary" />
  <CsComReference Include="C:\Libs\Legacy.tlb" Namespace="Legacy.Interop" />
</ItemGroup>

The code is generated into the intermediate output before the compilation, again only when the references, the options or the type libraries change. Each reference gets a namespace of its own: its Namespace metadata, or Interop.<Library>, e.g. Interop.Scripting:

using Interop.Scripting;

IDictionary dictionary = Dictionary.Create();
dictionary.Add("apple", 3);
Console.WriteLine(dictionary.Count);

The options, such as the events, the marshalling and the support code, are item metadata and CsCom* properties.

With <CsComExportTypeLibrary>true</CsComExportTypeLibrary>, the package also exports the type library (.tlb) of the [GeneratedComInterface] and [GeneratedComClass] types of the project after the compilation, like TlbExp.

Documentation

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

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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
4.1.0 102 11/25/2026
4.0.0 105 11/21/2026
4.0.0-rc.2 67 11/20/2026
4.0.0-rc.1 61 11/20/2026
3.0.0 109 11/13/2026
3.0.0-rc.1 67 11/13/2026
3.0.0-beta.2 64 11/13/2026
3.0.0-beta.1 69 11/13/2026
3.0.0-alpha1 95 11/12/2026
2.0.0 106 11/11/2026
2.0.0-beta.1 64 11/10/2026
2.0.0-alpha.1 72 11/2/2026
1.0.0 117 10/30/2026
1.0.0-beta.3 81 10/29/2026
1.0.0-beta.2 69 10/28/2026
1.0.0-beta.1 76 10/28/2026