In the startup code (Program.cs) there is some code setting up swagger with documentation.
builder.Services
.AddSwaggerGen(option => option.IncludeXmlComments(filePath));So how to get this filePath?
If you look up in the net you find something like this:
var filePath = Path.Combine(AppContext.BaseDirectory, CommentFile);As long time NCrunch user I am used to rewrite code like this to get the assembly of a type in the project and look for the xml file in the assembly´s directory.
Sadly this does not work here as the NuGet package Microsoft.AspNetCore.Mvc.Testing has a targets file which makes NCrunch copy the assembly (but not the documentation file) to the directory.
So building the solution leads to an output like this:
bin
Debug
api.dll
api.xml
api.test.dllNCrunch creates a structure like this:
1234
1
bin
Debug
api.dll
api.xml
2
bin
Debug
api.test.dllOnce I add the NuGet package Micrsoft.AspNetCore.Mvc.Testing to my test project the result changes to:
1234
1
bin
Debug
api.dll
api.xml
2
bin
Debug
api.dll
api.test.dllOf course now all my tests fail, cause the file api.xml is not found.
Is there any solution to this?