Swashbuckle custom asset not found
swagger, swashbuckle
Solution
I struggled with this for a while today in a ASP.NET C# project and finally resolved it by cobbling together a few different resources.
First (as noted in the Swagger comments), the item must be marked as an Embedded Resource by right-clicking the item in the solution explorer and going to Properties, and selecting Embedded Resource from the Build Action dropdown.
Second, the logical name can be tricky to identify. In my case, a dash in a directory name was being converted to an underscore once embedded, leading to lots of hair-pulling (hair_pulling?). The easiest way to get the true logical path is to get it from the Build Output window.
- Go to Tools => Options
- Expand the Projects and Solutions sidebar item and click Build and Run
- Set the MSBuild Output to Detailed.
- Clean the solution and rebuild, opening the Output window if necessary.
The output log should unambiguously state the true logical name of the file with a line like...
`Resource file 'swagger-ui\SwaggerUiStyle.css' gets manifest resource name 'MySolutionName.swagger_ui.SwaggerUiStyle.css'`
(credit to @bkwdesign for his excellent explanation on this part)
Problem
I added to SwaggerConfig.cs this string ``` c.CustomAsset("index", thisAssembly, "Table.Web.CustomContent.index.html"); ``` ...than I run the application, go to swagger docs and get error: An error has occurred. Embedded resource not found - Table.Web.CustomContent.index.html Swashbuckle.SwaggerUi.AssetNotFound The build action property of the index.html was set to embedded resource What should I do to fix it?