charlesdevandiere / xmldoc2md

Tool to generate markdown from C# XML documentation
https://charlesdevandiere.github.io/xmldoc2md/
MIT License
47 stars 18 forks source link

Resolve dependencies with a custom AssemblyLoadContext #10

Closed asiffermann closed 3 years ago

asiffermann commented 3 years ago

Hi @charlesdevandiere!

First, thanks for this great and simple tool! I wanted to use it, but encountered the following error with projects having NuGet dependencies:

22>Generation started: Assembly: Proffer.Email.SendGrid
23>  proffer.email.smtpemailservicecollectionextensions.md
22>Unable to generate documentation:
22>Unable to load one or more of the requested types.
22>Could not load file or assembly 'SendGrid, Version=9.23.1.0, Culture=neutral, PublicKeyToken=4f047e93159395ca'. The system cannot find the file specified.
22>D:\Repos\Github\asiffermann\proffer\src\Directory.Build.targets(4,5): error MSB3073: The command "dotnet xmldoc2md "D:\Repos\Github\asiffermann\proffer\src\Proffer.Email.SendGrid\bin\Debug\netstandard2\Proffer.Email.SendGrid.dll" docs\code --github-pages --back-button" exited with code 1.

So I followed .NET Core documentation to safely load plugins with dependencies, and added a custom AssemblyLoadContext to your project. With this addition, the tool generates markup as expected for all my libraries.

I also fixed the debug launch settings to work on both Visual Studio and VS Code with a simple debug build.

charlesdevandiere commented 3 years ago

Thank you so much @asiffermann! This is exactly the functionality I was looking for :wink: