dotnet / roslyn-sdk

Roslyn-SDK templates and Syntax Visualizer
MIT License
512 stars 257 forks source link

Resolving Documentation File Location #1122

Closed ConnerPhillis closed 12 months ago

ConnerPhillis commented 12 months ago

Apologies if this isn't the correct place for this question

I'm currently working on building an inline c# script editor for a private project and I'm hoping to include the comments for a list of system assemblies and nuget packages that I don't know beforehand.

So far, I've been able to get documentation back whenever I hard-code a metadata reference to where I know an assembly documentation is at, like in the following:

MetadataReference.CreateFromFile(
        assembly,
        new MetadataReferenceProperties(MetadataImageKind.Assembly),
        documentation: XmlDocumentationProvider.CreateFromFile("C:\\Users\\<username>\\.nuget\\packages\\microsoft.codeanalysis.workspaces.common\\4.8.0-2.final\\lib\\net7.0\\Microsoft.CodeAnalysis.Workspaces.xml")));

What I'm wondering is if there is a programmatic way that I can use to resolve the file locations for the xml documentation for 1) the System Assemblies 2) NuGet assemblies

I've seen that each of the packs in C:/program files/dotnet/packs include their documentation files, same with nuget packages, but the system assemblies in C:/program files/dotnet/sdk seem to not have their documentation files in the same location.

Hoping that since Visual Studio can resolve the documentation files that there might be a built-in way to do this?

Thanks in advance!

ConnerPhillis commented 12 months ago

I've thought a little bit more about this and have started to realize it's not as feasible as I was hoping. I'm beginning to think that what I should really be after is to just find where the system assemblies leave their docs, and create a folder where I'll have to instruct application owners to place in any xmldocs that they get for assemblies they're going to want to reference.

Thanks and sorry for the spam issue!