The question’s simple: how could one use embedded resources in asp.net applications? What are the steps to include a resource in the assembly, and how to reference it? What are the gotchas that could be encountered?
The question’s simple: how could one use embedded resources in asp.net applications? What are
Share
Edit: For a version without referencing Page and ClientScript, see What is the right way to handle Embedded Resources on a Razor View?
After spending a half of a day I’ve learned these:
to embed a resource one needs to set it’s Build Action to Embedded Resource (in VS Solution Explorer rightclick the file -> Properties)
next AsssemblyInfo.vb must be modified to make this resources available for WebResource queries. Add
[Assembly: System.Web.UI.WebResource("MyWebResourceProj.Test.css", "text/css")]to AssemblyInfo.vb located in MyProject folder of the project.Dim resNames = Assembly.LoadFile("YourDll.dll").GetManifestResourceNames()Referencing the resource can be done with
Page.ClientScript.GetWebResourceUrl(GetType(MyWebResourceProj.ConssumingPage), "MyWebResourceProj.Test.css")Resources: