Skip to content

Commit 82fe8e6

Browse files
authored
Merge pull request #834 from nojaf/docs/package-reference
Update API documentation generation.
2 parents c919b24 + fc63d07 commit 82fe8e6

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

docs/apidocs.fsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,40 @@ ApiDocs.GenerateHtml(
391391
substitutions = []
392392
)
393393

394+
(**
395+
### Adding extra dependencies
396+
397+
When building a library programmatically, you might require a reference to an additional assembly.
398+
You can pass this using the `otherFlags` argument.
399+
*)
400+
401+
let projectAssembly = Path.Combine(root, "bin/X.dll")
402+
403+
let projectInput = ApiDocInput.FromFile(projectAssembly)
404+
405+
ApiDocs.GenerateHtml(
406+
[ projectInput ],
407+
output = Path.Combine(root, "output"),
408+
collectionName = "Project X",
409+
template = Path.Combine(root, "templates", "template.html"),
410+
substitutions = [],
411+
otherFlags = [ "-r:/root/ProjectY/bin/Debug/net6.0/Y.dll" ]
412+
)
413+
414+
(**
415+
or use `libDirs` to include all assemblies from an entire folder.
416+
Tip: A combination of `<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>` in the fsproj file and setting `libDirs` to the compilation output path leads to only one folder with all dependencies referenced.
417+
This might be easier especially for large projects with many dependencies.
418+
*)
419+
420+
ApiDocs.GenerateHtml(
421+
[ projectInput ],
422+
output = Path.Combine(root, "output"),
423+
collectionName = "Project X",
424+
template = Path.Combine(root, "templates", "template.html"),
425+
substitutions = [],
426+
libDirs = [ "ProjectX/bin/Debug/netstandard2.0" ]
427+
)
394428

395429
(**
396430
## Rebasing Links
@@ -404,4 +438,4 @@ For example:
404438
[lang=text]
405439
dotnet fsdocs build --output public/docs --parameters root ../
406440
407-
*)
441+
*)

0 commit comments

Comments
 (0)