# dotnet/pinvoke

A library containing all P/Invoke code so you don't have to import it every time. Maintained and updated to support the latest Windows OS.

Repository: https://github.com/dotnet/pinvoke
Canonical: https://ross.abutalabs.com/products/pinvoke
Language: C#
License: MIT
License Family: permissive
Topics: pinvoke, dotnet, interop
Archived: true
Last push: 2023-07-26T11:36:20+00:00

## Health v2 (maintenance only)
Score: 10/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 3968, "days_push": 1134, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: archived
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2178, forks 223 (observed 2026-08-28T04:06:22.990980+00:00)

## What it is
A collection of .NET libraries providing pre-written, compile-verified P/Invoke signatures for Win32 and other native libraries, packaged as NuGet packages per native DLL. It offers higher-level APIs (SafeHandles, enums, XML docs) instead of raw IntPtr and uint flags.

## Use cases
- call win32 apis from c#
- p/invoke signatures for bcrypt or kernel32
- avoid hand-writing dllimport declarations
- build windows store apps using native apis
- interop with native libraries from .net

## When to choose
- maintaining a legacy .NET Framework or .NET Core app that already depends on these packages
- you need quick, tested P/Invoke signatures for common Win32 DLLs on older .NET targets

## When to avoid
- starting a new C# project - use CsWin32 instead, which is the recommended successor
- you need actively maintained support for the latest Windows APIs

## Facets
- artifact type: library
- maturity: abandoned
- function: sdk, developer-tools
- domain: windows, developer-tools, apis
- platform: windows, dotnet, cross-platform
- tags: pinvoke, interop, win32, csharp, nuget, native-interop

## Member repositories
- dotnet/pinvoke (main) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:22.990980+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:48:48.629998+00:00, confidence not recorded.
  - readme: https://github.com/dotnet/pinvoke (fetched 2026-08-28T04:06:22.990980+00:00, sha 30253e66885c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
