Here the solution that i found: https://github.com/dotnet/aspnetcore/discussions/55657
[Asp.Net Core MVC] Is posssible to embed the wwwroot directory inside the dist binary?

I have an Asp Net Core MVC project with my assets in wwwroot. My intent is to have only the binary and the appsettings file so is easy to update the application in production without to lose some updated assets files.
I used this options (https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=cli) the create the binary but the wwwroot is outside.
There is any way to embed that folder and calling assets embeded files from cshtml? (I have used this tecnics with the GO language).
Thanks
Developer technologies | ASP.NET | ASP.NET Core
2 answers
Sort by: Most helpful
-
-
Bruce (SqlWork.com) 77,926 Reputation points Volunteer Moderator
2024-05-10T16:09:06.8033333+00:00 you would need to write a custom static file handler, that used resources instead of files, and make all the files in wwwroot a resource. then the files would be in the bundle.
https://learn.microsoft.com/en-us/dotnet/core/extensions/create-resource-files