WeiXinMPSDK is a free, open source databases project written in C# and released under Apache-2.0. It has 8,896 GitHub stars, 4,342 forks and 219 open issues, and was last pushed 8 days ago. On this registry it ranks #89 of 143 tracked projects in Databases, with 5 head-to-head comparisons available.

What is WeiXinMPSDK?

Senparc.Weixin is an Apache-2.0 licensed, open-source .NET SDK for building against the full range of WeChat platforms — official accounts, mini programs, mini games, WeChat Pay, WeCom (Enterprise WeChat), the open platform, and JSSDK — and it is aimed at C# and .NET developers who need to integrate those services into their own applications.

What it is

Senparc.Weixin is a C# library family that wraps the WeChat platform APIs so that .NET developers do not have to hand-roll HTTP calls, signature verification, and message serialization for every WeChat product. It targets .NET Framework, .NET Core, and .NET 10.0, and it is distributed as a set of NuGet packages rather than a single monolith. The package list covers the platform surface directly: Senparc.Weixin.MP and Senparc.Weixin.MP.Middleware for official accounts, Senparc.Weixin.WxOpen for mini programs, Senparc.Weixin.Work for WeCom, Senparc.Weixin.TenPay and Senparc.Weixin.TenPayV3 for payments, Senparc.Weixin.Open for the open platform, and Senparc.Weixin.All as an aggregate. ASP.NET-specific glue ships separately as Senparc.Weixin.AspNet and Senparc.Weixin.MP.Mvc.

The concrete problem it solves is the integration layer between a .NET application and WeChat's many separate service APIs. Instead of writing and maintaining bespoke access-token management, message handling, and payment callback code for each platform, a team installs the relevant packages and builds on top of them. Because WeChat deployments commonly run across more than one server, the SDK also includes a distributed cache abstraction: Senparc.Weixin.Cache.Redis, Senparc.Weixin.Cache.CsRedis, Senparc.Weixin.Cache.Memcached, and Senparc.Weixin.Cache.Dapr are published packages, so access tokens and session state can be shared rather than held per-process.

Key capabilities

  • Covers official accounts, mini programs, mini games, WeChat Pay (including Senparc.Weixin.TenPayV3), Enterprise WeChat/企业号, the open platform, JSSDK, and WeChat peripheral services.
  • Ships per-platform NuGet packages — Senparc.Weixin.MP, Senparc.Weixin.WxOpen, Senparc.Weixin.Work, Senparc.Weixin.TenPay, Senparc.Weixin.Open — plus Senparc.Weixin.All for combined installs.
  • Provides ASP.NET and MVC integration through Senparc.Weixin.AspNet, Senparc.Weixin.MP.Mvc, Senparc.Weixin.MP.Middleware, and Senparc.Weixin.WxOpen.Middleware.
  • Supports distributed caching via Redis, CSRedis, Memcached, and Dapr cache packages, matching the topic tags cache, distributed-cache, and memcached.
  • Targets multiple .NET generations in one codebase: .NET Framework, .NET Core, .NET 8, and .NET 10.0.
  • Includes JSSDK support for web pages embedded inside WeChat clients.
  • Provides Senparc.WebSocket for WebSocket scenarios.

Who uses it and how

  • .NET shops building official account backends, where middleware packages handle inbound message routing inside an ASP.NET pipeline.
  • Teams shipping mini programs that need a C# server side rather than a JavaScript-only backend, using Senparc.Weixin.WxOpen.
  • Enterprises integrating WeCom alongside an existing internal .NET stack, via Senparc.Weixin.Work.
  • Multi-instance deployments that must share access tokens across nodes, using the Redis, CSRedis, Memcached, or Dapr cache packages instead of in-process storage.
  • Payment integrations requiring the v3 API, served by the separate Senparc.Weixin.TenPayV3 package.

Getting started

Install the NuGet packages for the platforms in use — for example Senparc.Weixin.MP for official accounts or Senparc.Weixin.All for the full set — and consult the project site at https://weixin.senparc.com. An English-language README is available as readme.en.md.

How it compares

No comparable tools are named in the supplied facts, and no list of paid products it replaces is provided. On the evidence available, it stands alone in this registry.

When to use it — and when not to

Use it when the team already works in C# or .NET and needs WeChat platform coverage without writing the integration layer from scratch; the project has been maintained for over 13 years and carries 8,896 stars and 4,342 forks. Be aware that a distributed deployment implies operating a cache backend such as Redis, CSRedis, Memcached, or Dapr, which is extra infrastructure to run. The repository also carries 219 open issues, so anyone adopting it should expect to read source and track the backlog; teams outside the .NET ecosystem, or those needing only a single narrow WeChat API, may find the package surface heavier than their need.

project readme (upstream, from github) — read inline

image

Senparc.Weixin —— 微信 .NET SDK

Build status NuGet GitHub commit activity the past week, 4 weeks, year Static Badge Senparc.Weixin.All license

Senparc.Weixin Senparc.Weixin.MP Senparc.Weixin.MP.Middleware Senparc.Weixin.MP.Mvc Senparc.Weixin.WxOpen Senparc.Weixin.WxOpen.Middleware Senparc.Weixin.Work Senparc.Weixin.Work.Middleware Senparc.Weixin.TenPay Senparc.Weixin.TenPayV3 Senparc.Weixin.Open Senparc.Weixin.AspNet Senparc.Weixin.Cache.Redis Senparc.Weixin.Cache.CsRedis Senparc.Weixin.Cache.Memcached Senparc.Weixin.Cache.Dapr Senparc.WebSocket

[English Version]

📈 Senparc.Weixin SDK 是目前使用率最高的微信 .NET SDK,也是国内最受欢迎的 .NET 开源项目之一。本项目已持续维护超过 13 年,助力大量系统和应用取得成功。我们将继续保持更新,并正在深度融合 AI 场景应用,示例正在逐步上线。欢迎加入我们的社区 👐

使用 Senparc.Weixin,您可以方便快速地开发微信全平台的应用(包括微信公众号、小程序、小游戏、企业号、开放平台、微信支付、JS-SDK、微信硬件/蓝牙,等等)。本项目的 Demo 同样适合初学者进行 .NET 编程学习。

目前 Senparc.Weixin 已经支持几乎所有微信平台模块和接口,并同时支持 .NET 3.5 / 4.0 / 4.5 / .NET Standard 2.x / .NET Core 2.x / .NET Core 3.x / .NET 6.0 / .NET 7.0 / .NET 8.0 / .NET 10.0 等多种框架,同时兼容所有 MVC、Razor、WebApi、Console(命令行)、桌面应用(.exe)、Blazor、MAUI、后台服务等环境,和外部框架完全解耦。

自 2013 年起立项 12 年多来,我们一直保持着项目的持续更新,并将完整的源代码以及设计思想毫无保留地分享给大家,希望有更多的人可以从中受益,理解并传播开源的精神,一同助力中国开源事业!感恩一路上给我们提供帮助的朋友们!

如果你喜欢并希望我们继续优化这个项目,请给我们一个 ★Star :)

🔔 公告

[!TIP] 🥇 盛派开发者社区 2025-2026 年度贡献者榜单
⚡ .NET 10 正式版已发布,最新 Sample for .NET 10(向下兼容), 在线 Sample:https://sdk.weixin.senparc.com/
🔥 AI 聊天机器人微信集成 Sample 已上线!查看
🎬 Scott Hansleman 关于 AI 话题的专访 查看视频

[!NOTE] 🔒 微信支付 V3 模块(V1.0)已上线!Nuget
🎠 全面支持长文本自动分片发送,更多:《顺应 GenAI 应用,自动“续航”回复超长文本消息》

🌟 Start:分模块独立说明文档 + Sample 代码示例

[!NOTE] 1、上述分模块示例中,同时包含了文档及可以立即运行的代码模板(只需要配置微信参数,无需修改任何代码)。
2、示例中的配置、注册、接口调用方法均一致,只要学会其中一个模块开发,就可以举一反三。以下的 Hello World 示例也以公众号为例,可以延伸到所有其他模块。
3、/docs 目录中提供了更完整的开发说明文档,供进阶开发使用,点击查看
4、对应于微信不同平台,Senparc.Weixin SDK 已经将各模块解耦并独立发布,为了简化引用,您也可以直接引用 Senparc.Weixin.All,自动引用所有模块。

🚀 Hello World :用 3 句代码开启你的微信开发之旅!

[!NOTE] 1、下述源码位于 /Samples/MP/Senparc.Weixin.Sample.MP 文件夹,以微信公众号为例。学会公众号就可以举一反三使用其他模块,基本用法一致(小程序、企业微信、微信支付等)。
2、如需查看其他模块或集成示例,可以查看位于 /Samples/ 文件夹下的其他独立 Sample,或 /Samples/All/ 文件夹下的集成 Sample(进阶)。

启动代码(只需 2 句代码):

1、 在 Program.cs 的 builder.Build() 上方添加配置:

builder.Services.AddSenparcWeixinServices(builder.Configuration);

如果您使用的是旧格式的 Startup.cs 文件,上述代码对应于 Startup.cs 的 ConfigureServices() 方法内。

2、 在 Program.cs 的 builder.Build() 下方启用配置:

var registerService = app.UseSenparcWeixin(app.Environment, null, null, register => { },
    (register, weixinSetting) =>
{
    //注册公众号信息(可以执行多次,注册多个公众号)
    register.RegisterMpAccount(weixinSetting, "【盛派网络小助手】公众号");
});
  • 如果您使用的是旧格式的 Startup.cs 文件,上述代码对应于 Startup.cs 的 Configure() 方法内。
  • 如果您希望系统自动注册所有配置好的账号,只需上述方法最后追加一个 autoRegisterAllPlatforms: true 的设置即可(需要引用 Senparc.Weixin.All 包):
var registerService = app.UseSenparcWeixin(app.Environment, null, null, register => { },
    (register, weixinSetting) => { /* 无需手动注册 */ },
    autoRegisterAllPlatforms: true /* 自动注册所有平台 */
);

调用高级接口(只需 1 句代码):

可在程序任意位置调用接口(以客服接口为例):

await CustomApi.SendTextAsync("AppId", "OpenId", "Hello World!");

[!TIP]

  1. Senparc.Weixin SDK 将全生命周期自动托管 AccessToken,因此开发过程只需提供 AppId,无需操心 AccessToken 过期等问题。
  2. AppId 等注册信息可从 Senparc.Weixin.Config.SenparcWeixinSetting 中自动获取,相关参数在 appsettings.json 中配置。
  3. 以上方法也支持同步方法:Senparc.Weixin.MP.AdvancedAPIs.CustomApi.SendText()
  4. 所有接口命名空间均参照官方 API 路径规则定义,且参数命名方式尽量与文档保持一致(特别是返回参数),以方便开发者在源码中快速查找定位、提升测试效率、降低 bug 发生的可能性。

[!TIP] 至此,您已经可以举一反三调用所有微信模块的接口啦!解锁更多技能请继续往下看。

如何使用公众号消息对话能力?

公众号默认提供了对话窗口,可以发送文字、图片、语音等不同类型的信息和程序互动。

以下示例同样适用于企业微信和小程序客服消息的对话,只需两步!

第一步:创建自定义 Me

readme truncated — read the full docs on github

Frequently asked questions

Is WeiXinMPSDK free to use?

WeiXinMPSDK is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does WeiXinMPSDK do?

微信全平台 .NET SDK, Senparc.Weixin for C#,支持 .NET Framework 及 .NET Core、.NET 10.0。已支持微信公众号、小程序、小游戏、微信支付、企业微信/企业号、开放平台、JSSDK、微信周边等全平台。 WeChat SDK for C#.

What is WeiXinMPSDK written in?

WeiXinMPSDK is primarily written in C#. Its source is publicly available at https://github.com/JeffreySu/WeiXinMPSDK, and it has 8,896 GitHub stars.