Apq.Cfg.Ini
1.0.4
dotnet add package Apq.Cfg.Ini --version 1.0.4
NuGet\Install-Package Apq.Cfg.Ini -Version 1.0.4
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="Apq.Cfg.Ini" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Apq.Cfg.Ini" Version="1.0.4" />
<PackageReference Include="Apq.Cfg.Ini" />
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 Apq.Cfg.Ini --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Apq.Cfg.Ini, 1.0.4"
#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 Apq.Cfg.Ini@1.0.4
#: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=Apq.Cfg.Ini&version=1.0.4
#tool nuget:?package=Apq.Cfg.Ini&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Apq.Cfg.Ini
INI 文件配置源扩展包。
仓库地址:https://gitee.com/apq/Apq.Cfg
依赖
- Apq.Cfg
- Microsoft.Extensions.Configuration.Ini(版本随目标框架:net6.0→6.0.0, net7.0→7.0.0, net8.0→8.0.0, net9.0→9.0.0)
用法
using Apq.Cfg;
using Apq.Cfg.Ini;
var cfg = new CfgBuilder()
.AddIni("config.ini", level: 0, writeable: true)
.Build();
// 使用配置节访问
var dbSection = cfg.GetSection("Database");
var connStr = dbSection.Get("ConnectionString");
// 枚举子键
foreach (var key in dbSection.GetChildKeys())
{
Console.WriteLine($"{key}: {dbSection.Get(key)}");
}
方法签名
public static CfgBuilder AddIni(
this CfgBuilder builder,
string path,
int level,
bool writeable = false,
bool optional = true,
bool reloadOnChange = true,
bool isPrimaryWriter = false)
参数说明
| 参数 | 说明 |
|---|---|
path |
INI 文件路径 |
level |
配置层级,数值越大优先级越高 |
writeable |
是否可写 |
optional |
文件不存在时是否忽略 |
reloadOnChange |
文件变更时是否自动重载 |
isPrimaryWriter |
是否为默认写入目标 |
INI 格式示例
; 根级别配置
AppName=MyApp
[Database]
ConnectionString=Server=localhost;Database=mydb
Timeout=30
[Logging]
Level=Information
配置键映射:
AppName→"AppName"Database:ConnectionString→"Database:ConnectionString"Logging:Level→"Logging:Level"
许可证
MIT License
作者
- 邮箱:amwpfiqvy@163.com
仓库
- Gitee:https://gitee.com/apq/Apq.Cfg
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 is compatible. 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.
-
net6.0
- Apq.Cfg (>= 1.0.0)
- Microsoft.Extensions.Configuration.Ini (>= 6.0.0)
-
net7.0
- Apq.Cfg (>= 1.0.0)
- Microsoft.Extensions.Configuration.Ini (>= 7.0.0)
-
net8.0
- Apq.Cfg (>= 1.0.0)
- Microsoft.Extensions.Configuration.Ini (>= 8.0.0)
-
net9.0
- Apq.Cfg (>= 1.0.0)
- Microsoft.Extensions.Configuration.Ini (>= 9.0.0)
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.4 | 39 | 12/26/2025 |
| 1.0.3 | 66 | 12/25/2025 |
| 1.0.2 | 67 | 12/25/2025 |
| 1.0.1 | 65 | 12/24/2025 |
| 1.0.0 | 113 | 12/22/2025 |
| 0.0.1-beta4 | 101 | 12/20/2025 |
| 0.0.1-beta3 | 133 | 12/20/2025 |
| 0.0.1-beta2 | 134 | 12/20/2025 |
| 0.0.1-beta1 | 200 | 12/19/2025 |