[Bug] Cannot exclude specific files
Describe the bug I've built a .NET Core web API application. When executing docfx init, it successfully generates documentation hosted on localhost. However, I encounter an issue when trying to exclude files in the 'Services' folder. The output during the build process appears as follows:
No files are found with glob pattern images/**, excluding <none>, under directory "D:\CS\SpeechSeek"
Shouldn't it also indicate excluding "_site/**" and whatever I specify in docfx.json? Regardless of the patterns I specify in docfx.json, the 'excluding' information is always null. I need to exclude a couple of folders from the documentation generation.
This is my docfx.json:
{
"metadata": [
{
"src": [
{
"src": "../Speechseek",
"files": [
"**/*.csproj"
]
}
],
"dest": "api"
}
],
"build": {
"content": [
{
"files": [
"**/*.{md,yml}"
],
"exclude": [
"_site/**", <-- no excluded??
"Services/** <-- no excluded??
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"output": "_site",
"template": [
"default",
"modern"
],
"globalMetadata": {
"_appName": "speechseek",
"_appTitle": "speechseek",
"_enableSearch": true,
"pdf": false
}
}
}
Conclusion:
docfx builds the documentation but not excluding specific folders and .cs files
I want to remove this files
From your screenshot.
It's intended to exclude SpeechSeekV2._0.Services namespace items from API` document page.
In this case. It need to configure Custom filter rules with following steps.
Steps
- Delete existing
apifolder contents. - Add
filterConfig.yalfile with following contents
apiRules:
- exclude:
uidRegex: ^SpeechSeekV2\._0\.Services
type: Type
- Add
"filter": "filterConfig.yml"config tometadatasection
How to test
- Run
docfx metadatacommand to generate API metadata - Run
docfx build --serve --open-browsercommand. - Confirm launched browser page.
uidRegex: ^SpeechSeekV2._0.Services type: Type
This was the problem, what I have done first (forgot to put it in the post), was the type was namespace. Shouldn't that work as well? Like, every class within that namespace should be excluded? I'm a bit confused now, but I'm happy that it's finally working. Thanks for the reply :)
Edit: both type and namespace works, not sure why. Also the output is still:
No files are found with glob pattern images/**, excluding <none>, under directory "D:\CS\SpeechSeek"
Is this normal or it should output excluding SpeechSeekV2._0.Services instead of excluding<none> ?
both type and namespace works, not sure why.
It can specify type: Namespace instead of type: Type.
If you intended to exclude all types under specified namespace.
When it needs to include some part of the types that defined at excluded namespace.
It need to use type: Type filter settings.
No files are found with glob pattern images/**, excluding
, under directory "D:\CS\SpeechSeek" Is this normal or it should output excluding SpeechSeekV2._0.Services instead of excluding ?
This warning is because there are no files in D:\CS\SpeechSeek\images\**.
And excluding <none> message is displayed because resource' section has no exclude' config.
"resource": [
{
"files": [
"images/**"
]
}
],
I encountered another bug (?). I managed to exclude SpeechSeekV2.0.Services, and then I started removing other things I don't need in my documentation. For example, Inherited Members make a lot of noise. I achieved this, but then Services would pop out again. I removed System.Object from the filterConfig.yml to exclude Services. However, I can't find a solution to remove both of them. And the most interesting thing now is that even though I removed Services for testing purposes, that namespace is still being excluded, even if it's not mentioned in filterConfig.yml??
Whenever I make changes, I build the documentation, and it throws an error if I have a typo in the filterConfig.yml, so I'm pretty sure that's not the problem.
I was following this documentation.
It might needs to escape . with \. inside uidRegex. (I've fixed above example configs)
What's the result of using the following configurations.
apiRules:
- exclude:
uidRegex: ^SpeechSeekV2\._0.Services
type: Type
- exclude:
uidRegex: ^System\.Object
And when you add exclude rules.
It's necessary to clean up api folder contents before running the `docfx metadata' command.
Since I removed namespaces that have this, it's not mendatory. But I tested it to see if it works, and it doesn't. I'll move on because I don't need it anymore.
- exclude: uidRegex: ^System.Object
And when you add
excluderules. It's necessary to clean upapifolder contents before running the `docfx metadata' command.
Not sure what you mean by that? Couldn't find documentation referring to this...
Also, I can't remove constructors and Inherited Members:
I want to be left only with methods and their return types.