This problem has been puzzling me all day - I am attempting to embed resources within a class library, buy I can only get it to work when the files are within the root of the class library.
My default namespace is
Lighthouse.Software.Library.Core - I have added
Test.css and
Test.png to the root of the class library, then within the class I have the following code:
<Assembly: WebResource("Lighthouse.Software.Library.Core.Test.css", "text/css", PerformSubstitution:=True)>
<Assembly: WebResource("Lighthouse.Software.Library.Core.Test.png", "image/png")>
Protected Overrides Sub CreateChildControls()
Dim Stylesheet As New HtmlLink
Stylesheet.Href = Me.Page.ClientScript.GetWebResourceUrl(GetType(MasterPage), "Lighthouse.Software.Library.Core.Test.css")
Stylesheet.Attributes.Add("type", "text/css")
Stylesheet.Attributes.Add("rel", "stylesheet")
Stylesheet.Attributes.Add("media", "screen")
Stylesheet.Attributes.Add("title", "Lighthouse")
Me.Page.Header.Controls.Add(Stylesheet)
End SubThis works correctly, however I wish to keep everything tidy by putting the resource files in sub-directories. I created a folder
Resources containing folders
Images and
Styles and adjusted my code like so:
<Assembly: WebResource("Lighthouse.Software.Library.Core.Resources.Styles.Test.css", "text/css", PerformSubstitution:=True)>
<Assembly: WebResource("Lighthouse.Software.Library.Core.Resources.Images.Test.png", "image/png")>
Protected Overrides Sub CreateChildControls()
Dim Stylesheet As New HtmlLink
Stylesheet.Href = Me.Page.ClientScript.GetWebResourceUrl(GetType(MasterPage), "Lighthouse.Software.Library.Core.Resources.Styles.Test.css")
Stylesheet.Attributes.Add("type", "text/css")
Stylesheet.Attributes.Add("rel", "stylesheet")
Stylesheet.Attributes.Add("media", "screen")
Stylesheet.Attributes.Add("title", "Lighthouse")
Me.Page.Header.Controls.Add(Stylesheet)
End SubNow it no longer works - I have read that it is possible, but it won't work for me!
Any suggestions would be much appreciated!