I'm developing ASP.NET Core 3.1 Web API and have my swagger setup. I have added swagger documentation to my project.
- Right click
API Project->Build->Output
This will generate
xxx.xmlfile in my project root folder.Right click ->
xxx.xml->Copy To Output Directory->Copy AlwaysI refer the
xxx.xmlfile in the swagger config inStartup.csas follows
var xmlCommentsFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlCommentsFullPath = Path.Combine(AppContext.BaseDirectory, xmlCommentsFile);
options.IncludeXmlComments(xmlCommentsFullPath);
Here I should use AppContext.BaseDirectory or Assembly.GetEntryAssembly().Location?
While running this in my local development, I can see this going inside bin\Debug\netcoreapp3.1\ but after publish folder structure will be same?. So correct path will be selected after publish and deploy?
