gpt4 book ai didi

documentation-generation - DocFX:为多个项目生成 API 文档

转载 作者:行者123 更新时间:2023-12-04 09:39:06 33 4
gpt4 key购买 nike

我正在处理一个解决方案中有多个项目的项目。我希望能够从外部目录生成文档以保持应用程序代码文件夹干净。当我尝试在我的 docfx.json 中设置 src 目录时,它似乎不喜欢绝对路径,也不喜欢相对路径。

{
"metadata":
[{
"src":
[{
"files": ["../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**/*.csproj"]
"exclude":
[
"**/obj/**",
"**/bin/**",
"_site/**"
]
}],
"dest": "api"
}],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"src": "../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices",
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"noLangKeyword": false
}
}

它说它构建得很好但没有找到任何文件,它搜索的目录保留在当前目录中。
D:\temp\WsiApiDocs\docfx_project>docfx metadata
Info: Config file docfx.json found, start generating metadata...
Info: No files are found with glob pattern **/*.csproj, excluding
**/obj/**,**/bin/**,_site/**, under directory "D:\temp\WsiApiDocs\docfx_project"
Info: Completed executing in 54.0087 milliseconds.


Build succeeded.
0 Warning(s)
0 Error(s)

当我尝试将相对路径放在 files 属性中时,我得到以下信息:
D:\temp\WsiApiDocs\docfx_project>docfx metadata
Info: Config file docfx.json found, start generating metadata...
Info: No files are found with glob pattern
../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**/*.csproj,
excluding **/obj/**,**/bin/**,_site/**, under directory
"D:\temp\WsiApiDocs\docfx_project"
**Warning: NOTE that `../` is currently not supported in glob pattern, please use `../` in `src` option instead.**
Info: Completed executing in 48.9621 milliseconds.


Build succeeded with warning.
Warning: NOTE that `../` is currently not supported in glob pattern, please use `../` in `src` option instead.
1 Warning(s)
0 Error(s)

所以我的困惑似乎在于如何使用 src 选项。如果在元数据中使用 src,那么我似乎无法指定文件和排除信息。我尝试在与元数据相同的级别上使用 src 属性,但这似乎没有任何作用。

最佳答案

正如错误所述

../ is currently not supported in glob pattern


files , exclude等使用全局模式。改为通过 src 设置基目录:

{
"metadata": [
{
"src": [
{
"files": "Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**.csproj",
"exclude": [
"**/obj/**",
"**/bin/**"
],
"src": "../../.." // <---- base directory
}
],
"dest": "api"
}
],
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
}
// ...
]
}

Here是构建多个项目的示例

关于documentation-generation - DocFX:为多个项目生成 API 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40936498/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com