Hi,
I am working in asp.net core 2.2. i using swagger for documentation and am able to configure and make it work. i am having one issue. i have included the xml comments for the propertied in of my class and its located in different class library project. i have referenced this class library assembly of my asp.net core api project. but how do i refer the xml file which is getting generated in my class library project? when i run the api, i can't see the swagger document.
To test it, i copied the xml file manually to the AppContext.BaseDirectory location, its showing. But i want this to happen automatically. please help me on referencing the class library project generated xml file in api project automatically.
for example
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", info); var filePath = $"{Assembly.GetExecutingAssembly() .GetName().Name}.xml"; filePath = Path.Combine(AppContext. BaseDirectory, xmlFile); c.IncludeXmlComments(filePath); });
the above code will picks the xml file which is build from the asp.net core project base directory. on my case, the xml file location is different. i mans the class library project location is different folder. only one option i can think of. the build path of the xml file can be given to the asp.net core project base directory. so whenever we build the class library project, it will gets copied to web project. is there any other way around?