Easy.Tool.MergeJson
1.0.1-beta2
This is a prerelease version of Easy.Tool.MergeJson.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Easy.Tool.MergeJson --version 1.0.1-beta2
NuGet\Install-Package Easy.Tool.MergeJson -Version 1.0.1-beta2
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="Easy.Tool.MergeJson" Version="1.0.1-beta2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Easy.Tool.MergeJson" Version="1.0.1-beta2" />
<PackageReference Include="Easy.Tool.MergeJson" />
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 Easy.Tool.MergeJson --version 1.0.1-beta2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Easy.Tool.MergeJson, 1.0.1-beta2"
#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 Easy.Tool.MergeJson@1.0.1-beta2
#: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=Easy.Tool.MergeJson&version=1.0.1-beta2&prerelease
#tool nuget:?package=Easy.Tool.MergeJson&version=1.0.1-beta2&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
自动合并json工具
只需引入该包,在生成时自动将指定的多个json文件合并,生成到项目的输出目录中
最快使用
只需要对项目根目录的 appsetting*.json 添加一下json即可
// 自定义配置信息
"CustomConfigInfo": {
// 子文件目录集合
"ConfigFileFolders": [ "CustomConfig1", "CustomConfig2" ],
// 要排除的文件名集合
"ExcludeSubFiles": [ "json2.json" ]
}
配置
保存合并日志【在输出目录中生成mergeLogs文件夹存放合并日志】
<PropertyGroup><SaveMergeLog>true</SaveMergeLog></PropertyGroup>
合并包含的json文件(存放所有可能会参与合并的json)
<ItemGroup>
<JsonItems Include="要包含的json文件" Exclude="排除的json文件" />
</ItemGroup>
主要json文件,这些文件都需要在 <JsonItems> 里面存在
<ItemGroup>
<MainJsonItems Include="主要json文件" />
</ItemGroup>
默认
<PropertyGroup>
<SaveMergeLog>false</SaveMergeLog>
</PropertyGroup>
<ItemGroup>
<JsonItems Include="**\*.json" Exclude="$(BaseOutputPath)**\*;$(BaseIntermediateOutputPath)**\*;" />
<MainJsonItems Include="appsettings*.json" />
</ItemGroup>
日志:默认情况下不会保存合并日志
包含的json:工作目录中所有的json文件
主要json文件:工作根目录中所有以【appsettings】开头【.json】后缀的文件
寻找子json:
1.子json被包含在<JsonItems>中
2.主json中存在【CustomConfigInfo.ConfigFileFolders】节点(数组类型),存放子json目录路径
3.主json中【CustomConfigInfo.ExcludeSubFiles】节点,存放排除的子json文件名,这里面的json都不会被合并
注:如果主json是在工作目录中,合并后的文件也会在输出目录的相对位置,否者就直接输出到输出文件中
自定
? 通配符匹配单个字符。
* 通配符匹配零个或多个字符。
** 通配符序列匹配部分路径。
修改包含的json文件
<ItemGroup>
移除当前包含的所有文件
<JsonItems Remove="**\*" />
包含工作根目录中的所有json,排除a.json
<JsonItems Include="*.json" Exclude="a.json" />
包含工作目录中的所有json,排除所有a前缀的json文件
<JsonItems Include="**\*.json" Exclude="**\a*.json" />
包含e盘中的所有json
<JsonItems Include="e:\**\*.json" />
</ItemGroup>
修改主json文件
<ItemGroup>
包含 CusuomConfig 目录中的config.json
<MainJsonItems Include="CusuomConfig\config.json" />
修改存放子文件的节点
<MainJsonItems Update="包含的文件">
<SubDirectoryNode>CustomConfigInfo.ConfigFileFolders</SubDirectoryNode>
<ExcludeSubFilesNode>CustomConfigInfo.ExcludeSubFiles</ExcludeSubFilesNode>
</MainJsonItems>
</ItemGroup>
更新日志
1.0.0
发布第一个正式版
1.0.1-beta1
1.修复包含子json文件夹路径是盘符根路径(e:)引发的异常
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
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.2 | 544 | 6/25/2022 |
1.0.1 | 464 | 5/24/2022 |
1.0.1-beta2 | 251 | 5/5/2022 |
1.0.1-beta1 | 238 | 5/5/2022 |
1.0.0 | 519 | 5/5/2022 |
1.0.0-beta9 | 233 | 5/1/2022 |
1.0.0-beta8 | 238 | 4/27/2022 |
1.0.0-beta7 | 229 | 4/27/2022 |
1.0.0-beta6 | 228 | 4/27/2022 |
1.0.0-beta5 | 240 | 4/25/2022 |
1.0.0-beta4 | 233 | 4/25/2022 |