# Bring your KMP library to NuGet

DevFeed: [Bring your KMP library to NuGet](<https://devfeed.tech/articles/bring-your-kmp-library-to-nuget-25915.md>)

Original publisher: [Read original article](<https://proandroiddev.com/bring-your-kmp-library-to-nuget-02e1131a4707?source=rss-43bae76e8f81------2>)

Author: Isuru Rajapakse

Published: 2026-07-19T13:17:14Z

Content type: tutorial

Language: en

Sources: [Stories by Isuru Rajapakse on Medium](<https://devfeed.tech/sources/stories-by-isuru-rajapakse-on-medium.md>)

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [NuGet](<https://devfeed.tech/topics/nuget.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [.NET](<https://devfeed.tech/topics/net.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [multiplatform](<https://devfeed.tech/topics/multiplatform.md>), [Library](<https://devfeed.tech/topics/library.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [library](<https://devfeed.tech/tags/library.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>), [net](<https://devfeed.tech/tags/net.md>), [nuget](<https://devfeed.tech/tags/nuget.md>), [nuget-package](<https://devfeed.tech/tags/nuget-package.md>)

## AI overview

The article introduces kotlin-native-nuget, a Gradle plugin that packages Kotlin/Native libraries as NuGet packages with generated idiomatic C# bindings. It explains the motivation, configuration, publishing workflow, and supported mappings for Kotlin features such as classes, enums, data classes, coroutines, generics, interfaces, and exceptions.

## Source excerpt

with kotlin-native-nuget plugin, you can bring your Kotlin to C# idiomaticallyhttps://medium.com/media/0f185efc67390bbf440bfc33f5675f42/href A little while ago, I gave a talk where I tried to take a library written in Kotlin and hand it to a .NET developer as a NuGet package. By hand. It is 30 minutes of me walking into every brick wall you can imagine - the C ABI, marshalling strings, keeping objects alive across the boundary, making any of it look like C# a human would actually want to use. Introducing kotlin-native-nuget 🪟kotlin-native-nuget plugin auto-binds your kotlin api into C# I turned all of that into a plugin, so you don't have to hit a single one of those walls. You write Kotlin, and out the other side comes a NuGet package with a proper, idiomatic C# API: classes, enums, data classes, coroutines, Flow, generics, interfaces, the works. No FFI boilerplate, no hand-written [DllImport], no "here's a C header, good luck". Your friends over in .NET just `dotnet add package` it and use it like it was C# all along. It's called kotlin-native-nuget, and it's a Gradle plugin. Here's the pitch: GitHub - xxfast/kotlin-native-nuget: A plugin that packages a Kotlin/Native library as a NuGet package with generated C# bindings, and consumes C# NuGet packages from Kotlin The pitch 🛗plugins { kotlin("multiplatform") id("io.github.xxfast.kotlin.native.nuget") version "<version>" } kotlin { mingwX64 { binaries { sharedLib { baseName = "mycatlib" } } } macosArm64 { binaries { sharedLib { baseName = "mycatlib" } } } } nuget { publish { packageId = "MyCatLib" version = "1.0.0" authors = "yourname" description = "My Kotlin/Native library" rootPackage = "com.example.cats" } } That's it. Add the plugin, point it at your native targets, and run the publish task. Out pops a .nupkg. Why though? 🤔 It's a fair question. I got it a lot (even on that talk) Kotlin Multiplatform already reaches an absurd number of places: the JVM, Android, iOS, JS, Wasm, and native desktop. But there's th