WeComKit.MsgAudit 1.0.0

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

WeComKit.MsgAudit

WeComKit.MsgAudit 是企业微信会话存档官方原生 SDK 的托管封装。它会串行化访问原生 Sdk* 指针,提供适合 .NET 应用使用的同步/异步方法,并保持原生 SDK 部署显式可控。

WeComKit.MsgAudit is a managed wrapper for the official WeCom message-audit native SDK. It serializes calls to the native Sdk* pointer, exposes sync/async helpers for .NET applications, and keeps native SDK deployment explicit.

安装 / Install

dotnet add package WeComKit.MsgAudit --version 1.0.0

原生 SDK 要求 / Native SDK Requirement

本包不包含、也不会自动下载企业微信官方会话存档原生 SDK。请从企业微信管理后台下载会话存档 SDK,并自行部署原生文件。

This package does not include or download the official native message-audit SDK. Download it from the WeCom admin console and deploy the native files yourself.

Windows 通常需要:

Windows usually requires:

  • WeWorkFinanceSdk.dll
  • libcrypto-3-x64.dll
  • libssl-3-x64.dll
  • libcurl-x64.dll

Linux 需要:

Linux requires:

  • libWeWorkFinanceSdk.so

Linux 环境还需要确保官方 .so 依赖的 OpenSSL / curl 等系统库能被动态链接器找到。不同发行版和官方 SDK 版本可能依赖不同库版本,建议在部署环境中用 ldd libWeWorkFinanceSdk.so 先检查。

On Linux, make sure OpenSSL / curl and other dependencies required by the official .so are discoverable by the dynamic linker. The exact versions may vary by distribution and SDK release. Run ldd libWeWorkFinanceSdk.so in the deployment environment first.

配置原生 SDK 路径 / Configure Native SDK Path

任选一种方式:

Use one of these options:

  • 设置环境变量 WECOM_MSG_AUDIT_SDK_DIR / set environment variable WECOM_MSG_AUDIT_SDK_DIR
  • 调用 WeComFinanceSdk.SetSdkDirectory(path) / call WeComFinanceSdk.SetSdkDirectory(path)
  • 将原生文件复制到应用输出目录 / copy native files into the application output directory
  • 在消费项目中设置 MSBuild 属性 WeComMsgAuditSdkPath / set MSBuild property WeComMsgAuditSdkPath
<PropertyGroup>
  <WeComMsgAuditSdkPath>C:\wecom-msg-audit-sdk</WeComMsgAuditSdkPath>
  <WeComMsgAuditCopySdkFiles>true</WeComMsgAuditCopySdkFiles>
</PropertyGroup>

MSBuild 自动复制默认关闭,避免 NuGet 包对消费项目产生隐式构建副作用。只有设置 WeComMsgAuditCopySdkFiles=true 时才会复制 SDK 目录下的 .dll / .so 文件到输出目录。

MSBuild copying is opt-in to avoid implicit build side effects in consuming projects. Set WeComMsgAuditCopySdkFiles=true to copy .dll / .so files from the configured SDK directory into the output directory.

使用 / Usage

using WeComKit.Core;
using WeComKit.MsgAudit;

WeComFinanceSdk.SetSdkDirectory(@"C:\wecom-msg-audit-sdk");

var nativeLoad = WeComFinanceSdk.DiagnoseNativeLoad();

await using var sdk = await WeComFinanceSdk.CreateAndInitAsync(corpId, secret);
var response = await sdk.GetChatDataResponseAsync(seq: 0, limit: 100);

foreach (var item in response.ChatData)
{
    var key = WeComUtility.DecryptRsa(item.EncryptRandomKey, privateKeyPem);
    var record = await sdk.DecryptChatRecordAsync(key, item.EncryptChatMsg);
}

诊断 / Diagnostics

var availability = WeComFinanceSdk.CheckAvailability();
var nativeLoad = WeComFinanceSdk.DiagnoseNativeLoad();
var steps = WeComFinanceSdk.Diagnose(corpId, secret);

DiagnoseNativeLoad 只检查文件发现和动态库加载,不需要企业微信凭据。Diagnose 可能调用原生 SDK 和企业微信服务,适合安装配置检查,不适合作为高频健康检查。

DiagnoseNativeLoad checks file discovery and native loading only, without WeCom credentials. Diagnose may call the native SDK and WeCom service. Use it for setup checks, not as a hot-path health probe.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in 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
1.0.0 93 5/24/2026

First stable release for the managed WeCom message-audit native SDK wrapper with explicit SDK path resolution and diagnostics.