- 项目介绍 / Introduction
- 开发环境 / Development Environment
- 快速开始 / Quick Start
- 项目结构 / Project Structure
- 模块加载顺序 / Module Loading Order
- 可用的 Nuget 包 / Available NuGet Packages
- 贡献指南 / Contributing
- 许可证 / License
本项目为 NCF(NeuCharFramework) 模板官方包的核心基础库源码。
当您使用 NCF 模板开发项目时,核心基础库将为您提供一系列基础能力的支撑,通常情况下您无需关心这些库的具体实现,只需要引用即可。
当您需要了解、修改或调试相关基础库时,您可以通过本项目获取源码。
NCF 文档地址:https://doc.ncf.pub/。
- Visual Studio 2019+ 或 VS Code 最新版本
- .NET 8.0
- 支持的数据库:
- SQLite
- MySQL
- SQL Server (2012+)
- PostgreSQL
- Oracle
- DM(达梦)
- 克隆仓库
git clone https://github.com/NeuCharFramework/NcfPackageSources.git- 打开解决方案
cd NcfPackageSources
start NcfPackageSources.sln # Windows
open NcfPackageSources.sln # macOS- 还原包
dotnet restore- 还原工作负载(可选)
dotnet workload restore- 编译运行
dotnet build
dotnet run| 文件夹 / Folder | 说明 / Description |
|---|---|
| src/Basic | 必须安装的基础官方库,以 Separc.Ncf. 开头 Required basic official libraries, prefixed with Separc.Ncf. |
| src/Extensions | 可选的扩展包,以 Senparc.Xncf. 开头 Optional extension packages, prefixed with Senparc.Xncf. |
| src/Extensions/System | 系统模块 System modules |
工作区运行时项目统一命名为 Senparc.Xncf.WorkspaceAgent(仅在 Xncf 两侧保留两个点),目录、程序集、命名空间和 Docker 入口使用同一名称。
The Workspace runtime project is named Senparc.Xncf.WorkspaceAgent, with exactly two dots around Xncf; its directory, assembly, namespace and Docker entry point use the same name.
Workspace 通过项目引用获取 Agent 的实际输出路径,并将 .dll、.deps.json 和 .runtimeconfig.json 传递至管理端及宿主的 build/publish 输出。不要根据宿主的 $(Configuration) 拼接 Agent 路径;解决方案中的依赖项目可能采用不同配置。自定义 SenparcXncfWorkspace:AgentPath 时需同步更新文件名。
Workspace resolves the Agent's actual output paths through its project reference and propagates the .dll, .deps.json and .runtimeconfig.json to Admin and host build/publish outputs. Do not construct Agent paths from the host's $(Configuration): solution dependencies may use a different configuration. Update the filename in any custom SenparcXncfWorkspace:AgentPath setting.
ADO 流水线 使用 Release 构建,由各项目的 GeneratePackageOnBuild 配置生成 .nupkg,随后自动发现并推送包。新增需要发布的库(包括 Abstractions 契约项目)时,必须启用 Release 自动打包;仅添加项目引用不会生成依赖项目的 NuGet 包。
The ADO pipeline builds in Release and relies on each project's GeneratePackageOnBuild setting to create .nupkg files before discovery and push. Enable Release packaging for every new published library, including abstraction contracts; a project reference alone does not generate its dependency's NuGet package.
需要发布的契约项目还必须加入 CI 使用的 src/NcfPackageSources.sln,并启用 Release 构建映射。未登记在解决方案中的依赖可能被 MSBuild 移除父级配置,回退到 Debug,从而不生成仅在 Release 时打包的 .nupkg。
Published contract projects must also belong to the CI solution, src/NcfPackageSources.sln, with Release build mappings enabled. MSBuild may remove the parent configuration from dependencies missing from the solution, causing a fallback to Debug and skipping Release-only package generation.
推送前会按 MSBuild 求值后的包 ID、版本和输出目录检查 Senparc.Ncf.Shared.Abstractions、Senparc.Xncf.FileManager.Abstractions、Senparc.Xncf.MCP.Abstractions 与 Senparc.Xncf.Workspace.Abstractions 的包文件。构建或检查失败时不执行推送。修复漏发包后重新运行流水线即可补发缺失版本,已存在版本仍通过 --skip-duplicate 跳过。
Before pushing, the pipeline checks the Senparc.Ncf.Shared.Abstractions, Senparc.Xncf.FileManager.Abstractions, Senparc.Xncf.MCP.Abstractions, and Senparc.Xncf.Workspace.Abstractions package files using their evaluated MSBuild package IDs, versions and output directories. Build or validation failures prevent pushing. Rerun the pipeline to publish missing versions after fixing packaging; existing versions are skipped with --skip-duplicate.
使用 [XncfOrder(x)] 特性指定模块的加载顺序,为降序排列,数字越大越在前:
The [XncfOrder(x)] attribute specifies the loading order of modules in descending order, larger numbers load first:
0:默认值,可以不用设置 / Default value, no need to set1~5000:需要预加载的重要模块 / Important modules that need preloading5000+:系统及基础模块 / System and basic modules58xx:AI 相关基础模块 / AI-related basic modules59xx:系统底层基础模块 / System underlying basic modules
契约包只暴露跨模块接口,可单独引用,不必依赖对应模块的实现程序集。
Abstraction packages expose cross-module contracts and can be referenced without the corresponding module implementation.
我们欢迎开发者为 NCF 贡献代码。如果您想要贡献,请:
We welcome developers to contribute to NCF. If you want to contribute, please:
- Fork 本仓库 / Fork this repository
- 创建您的特性分支 / Create your feature branch
- 提交您的改动 / Commit your changes
- 推送到分支 / Push to the branch
- 创建 Pull Request / Create a Pull Request
Apache License Version 2.0
详细请参考 / For details, please refer to: LICENSE