Wednesday, March 21, 2012

Web Resource Referencing

In the ajax Control Toolkit, web resources are referenced by the directory they are in.

For example:

[assembly: System.Web.UI.WebResource("AjaxControlToolkit.Accordion.AccordionBehavior.js", "text/javascript")]

I cannot figure out how this is done. I am writing some custom extenders, and I want to reference resources look the above, but the file always ends up being in [Root namespace].Resource

instead of [Root NameSpace].Directory.Resource.

For example, I have a project, with RootNameSpace "Root", and a Directory inside Root named Directory, and Resource.js, is inside Directory.

If I embed the resource, and reference it with Root.Directory.Resource.js I get, Assembly 'Root, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' contains a Web resource with name 'Root.Directory.Resource.js', but does not contain an embedded resource with name 'Root.Directory.Resource.js'

However, if I reference with Root.Resource.js, it runs fine.

I think there is an assembly option somewhere that I am not seeing, but I have searched, and I cannot find anything.

Can I have some help?

In C# the resources are references by directory, in VB, the resources are always embedded at the root. Is there anyway to change this behavior?

No comments:

Post a Comment