So you’ve setup you docfx documentation project. You ran it, clicked on the api documentation link and there was nothing.
You might need to thank Microsoft; it turns out that Microsoft recently (July/August 2022 timeframe) made a change that broke a couple of things and depending on your systems configuration you may, or not, run into this issue. For docFX it looks like it was reported in mid July but there other packages and framesworks impacted. The good news is that it is fairly easy to fix. You can read more about the issue here. My thanks to Jon Skeet who posted this “hacky fix”. I simply extrapolated the fix for the DocFX.console package and put together some basic directions.
- In your documentation project expand the dependencies
- Expand the packages
- View the properties of the docfx.console package and grab the path
- Open the docfx.console package path (something like C:\Users\<user>\.nuget\packages\docfx.console\<version>) in the file explorer
- Use your favorite text editor (or VS) and open docfx.exe.config from the tools directory
- Add the following assembly Binding in the runtime section of the config.
- Rebuild your documentation project and try again. If you get an error about the dll missing, your configuration is different from my setup and that’s ok. Here is what you need to do-
- Download System.Memory NuGet package version 4.5.5 from nuget.org
- Extract lib/net461/System.Memory.dll to the tools directory in docfx.console package path.
- Rebuild your documentation project and try again. At this point it should work.
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-184.108.40.206" newVersion="220.127.116.11" />
If you have docFX installed and use the command line options you may need to repeat the same process for the docFX install.