{"id":20395269,"url":"https://github.com/kodraus/cargo-nuget","last_synced_at":"2025-04-12T12:21:56.940Z","repository":{"id":54497681,"uuid":"80155330","full_name":"KodrAus/cargo-nuget","owner":"KodrAus","description":"A tool for packaging Native Rust libs as Nuget nupkgs","archived":false,"fork":false,"pushed_at":"2021-02-15T13:18:03.000Z","size":895,"stargazers_count":33,"open_issues_count":8,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-07T00:18:49.267Z","etag":null,"topics":["build-tool","nuget","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KodrAus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-26T21:03:47.000Z","updated_at":"2024-11-06T22:19:05.000Z","dependencies_parsed_at":"2022-08-13T17:50:33.961Z","dependency_job_id":null,"html_url":"https://github.com/KodrAus/cargo-nuget","commit_stats":null,"previous_names":["kodraus/nuget-rs"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KodrAus%2Fcargo-nuget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KodrAus%2Fcargo-nuget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KodrAus%2Fcargo-nuget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KodrAus%2Fcargo-nuget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KodrAus","download_url":"https://codeload.github.com/KodrAus/cargo-nuget/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224727059,"owners_count":17359533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","nuget","rust"],"created_at":"2024-11-15T03:55:53.230Z","updated_at":"2024-11-15T03:55:53.965Z","avatar_url":"https://github.com/KodrAus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `cargo-nuget` [![Latest Version](https://img.shields.io/crates/v/cargo-nuget.svg)](https://crates.io/crates/cargo-nuget)\n\nPack native Rust libraries as .NET Nuget packages.\n\n## Build Status\n\nPlatform                             | Rust Version      | DotNet SDK Version | Status\n------------------------------------ | ----------------- | ------------------ | ---------------\nLinux (Debian x64) / OSX (10.12 x64) | Stable (1.18.0)   | 2.0.0              | [![Build Status](https://travis-ci.org/KodrAus/cargo-nuget.svg?branch=master)](https://travis-ci.org/KodrAus/cargo-nuget)\nWindows (MSVC x64)                   | Stable (1.18.0)   | 2.0.0              | [![Build status](https://ci.appveyor.com/api/projects/status/v7mum8fgs5ho3oua?svg=true)](https://ci.appveyor.com/project/KodrAus/nuget-rs)\n\n## Progress\n\n- [x] Package builds for local target\n- [x] Release as cargo tool\n- [x] Package builds for cross-platform targets _(limited to pre-built cross-platform libs)_\n\n## Installation\n\n```shell\n$ cargo install cargo-nuget\n```\n\n## Usage\n\nSee [a complete example](https://github.com/KodrAus/cargo-nuget/tree/master/tests).\n\nRunning `cargo-nuget pack` will attempt to pack a local build of the crate in the current directory as a `nupkg`:\n\n```shell\n$ cargo-nuget pack\n$ tree\n.\n├── Cargo.lock\n├── Cargo.toml\n├── your_crate.0.1.0-dev.1489461345.nupkg\n├── src\n│   └── lib.rs\n└── target\n```\n\nRunning `cargo-nuget cross` will attempt to pack a cross-platform build of the crate in the current directory as a `nupkg`:\n\n```shell\n$ cargo-nuget cross --targets win-x64 linux-x64 osx-x64 --win-x64-path ./target/x86_64-pc-windows-gnu/debug/your_crate.dll --linux-x64-path ./target/x86_64-unknown-linux-gnu/debug/libyour_crate.so --osx-x64-path ./target/x86_64-apple-darwin/debug/libyour_crate.dylib\n$ tree\n.\n├── Cargo.lock\n├── Cargo.toml\n├── your_crate.0.1.0.nupkg\n├── src\n│   └── lib.rs\n└── target\n```\n\nThe `cross` command requires the relevant targets are listed along with paths to pre-built libraries for each platform.\nThis restriction should be removed in the future.\n\nFor a complete set of commands:\n\n```shell\n$ cargo-nuget --help\n```\n\n### The process\n\nHere's the basic workflow we want to support:\n\n1. Write a Cargo-based Rust library\n1. Populate your `Cargo.toml` crate metadata\n1. Run `cargo-nuget` to run a `cargo build` and get a `nupkg` containing a dev build for your current platform\n1. Reference your crate name as a dependency in your .NET project file\n1. `DllImport` your crate name\n\nSome additional options may be supplied:\n\n```shell\n$ cargo-nuget pack --test\n$ cargo-nuget pack --cargo-dir=some-crate/path/\n$ cargo-nuget pack --nupkg-dir=some-folder/nuget/\n$ cargo-nuget pack --release\n```\n\n## About\n\nThis is a tool for packaging Rust libraries as a Nuget package for consuming in .NET. The basic idea is to use the native Rust target for a development build and write the package to some local feed\n\nIn general the tool should:\n\n- Support typical Rust and .NET build pipelines\n- Work\n\n### Why use packages?\n\nThe new .NET Core tooling for packages is a big improvement over the old way. I think it's possible to support development workflows using packages in .NET in a way we couldn't do before. Being able to referernce native assemblies using packages has the benefit of working the exact same way in dev as it would in the wild.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodraus%2Fcargo-nuget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodraus%2Fcargo-nuget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodraus%2Fcargo-nuget/lists"}