ContributionsMost RecentMost LikesSolutionsHow to embed swagger.json as a resource of a dotnet assembly I have an externally generated swagger.json file I want to create as an embedded resource for a middleware component hosted in ,net core 6 solution. using a static file I can use the following code builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); app.UseStaticFiles(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger.json", "Credible FHIR")); app.Run(); I then have wwwroot/swagger.json containing my static swagger content. What I'd like to do is turn swagger.json content to an embedded resource and use that in my assembly.