dotnet / dotnet/aspnet-api-versioning
xmldoc file detection by assembly from a referenced project
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 721
- Avg merge
- 12h 51m
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
I have an issue with xmldocs and assemblies in a situation similar to #1175
1. `.AddApiVersioning.AddOpenApi()` is in a Library.csproj
2. Running code is in `App.csproj`, which imports the library
3. BOTH csproj have xmldoc generation enabled
GetAssemblies behaves like this:
```cs
callingAssembly = Library
entryAssembly = App
assemblyList = [Library, App]
// assembly list is passed to XmlCommentsFile constructor
for(var i in assemblies)
if file.exists() return // first wins
```
so `XmlCommentsTransformer` ends up with Library.xml instead of App.xml
by the way, is there any documentation on how xmldocs are loaded for referenced projects, nuget packages, etc? i searched for aspnet openapi (not versioned) and they have an unresolved issue that `.AddOpenApi` triggers an interceptor so this call must be placed in the app directly, not in nuget or other csproj. does versioned openapi do anything about this? i'm asking because it's not clear what default expected behavior should be, and how to customize it, eg load xmldocs for all referenced assemblies if it's not by default.
from the looks of `XmlCommentsTransformer` there is only one path where xmldoc is loaded from, and service registration does not allow for multiple xml transformers. `XmlCommentsFile` is internal so it's impossible to register it and pass assemblies directly
### Expected Behavior
xmldocs should be loaded for application, all referenced projects and nugets
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
10.0.200
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.