exclude files from csproj
DocFX Version Used: 2.36.2 (nuget)
Template used: default
Steps to Reproduce:
I'm trying to use docfx to generate code from assemblies and a unity project using these assemblies through several src entries (all through one docfx.json file).
For example, let's say I have a class A in
"src": [ { "files": [ "**.csproj" ], "src": "..\\pathTo\\MyLibrarySource" } ], "dest": "api-library", "globalNamespaceId": "Global",
This works as expected
I have an src entry for the unity part but I can't get it to work
If I include all cs files of my unity project, I can exclude some. For example, if I have a class B that inherits from A in :
"src": [ { "files": [ "Assets/MyScriptDir/**/**.cs", ], "exclude": [ "**/Editor/**" ], "src": "..\\..\\Unity" } ], "dest": "api-unity", "globalNamespaceId": "Global",
docfx will make a documentation where B inherits from Object, not from A
So I tried to use the csproj generated by unity to solve this: "src": [ { "files": [ "*.csproj" ], "exclude": [ "/Editor/", ], "src": "..\..\Unity" } ], "dest": "api-unity", "globalNamespaceId": "Global"
This time, docfx correctly says that B inherits from A but my exclude is ignored.
@flonou Please use API Filter.
exclude in src should exclude the file included by src/files, e.g.:
"src": [
{
"files": [
"**/**.csproj",
],
"exclude": [
"Editor/*.csproj"
]
}
]
This means build all project exclude the project file under editor folder.
For your cs version (
"src": [ { "files": [ "Assets/MyScriptDir/**/**.cs", ], "exclude": [ "**/Editor/**" ], "src": "..\\..\\Unity" } ], "dest": "api-unity", "globalNamespaceId": "Global",), it is same as: create a csproj file, then add all cs files and remove the exclude cs files, then compile. And compiler will get source like following:
public class B : A {}
// but A do not have declare, so A is an error type, B inherited from object.
@vwxyzh Does this mean I can only filter classes, members etc. but not the files themselves ?
@flonou yes.
then that's not quite I want. I don't want to list all the classes to exclude, only folders, but while using an sln or csproj as source file. Should I open an issue to ask for this functionality ?
I agree. You should be able to point it to a .csproj file, build the project, but then only create documentation for classes or folders that you want.
Maybe I want someone to see the models I am producing but they don't need to see all the interfaces, helper functions, whatever else is in my code.