views:

1935

answers:

3

I'm trying to export a control library in a .dll for other developers in the office to consume.

The solution I original created looks like this:

Solution 1:
- Mri.Controls (Class Library)
- Mri.FmTool (Web Application)

Mri.FmTool references Mri.Controls.

Inside Mri.Controls, I have some javascript WebResources. Mri.FmTool seems to read the WebResources just fine, all my javascript web resouces appear as they should when Mri.FmTool web app is running.

So, now I was trying to create a simple solution to consume Mri.FmTool

Solution 2:
- Mri.ConsumerTest (Web Application)

I took the latest Mri.Controls.dll and added it as a reference to Mri.ConsumerTest application. All the controls from Mri.Controls seem to be working inside Mri.ConsumerTest. Intellisense is working, it compiles, no issues.

However, when running it, most of the WebResource.axd files are empty, just blank. One WebResource.axd file isn't blank, it simply says "This resource cannot be found."

Here are the properties of the javascript files inside the Properties window:
Build Action: "Embedded Resource"
Copy to Output Directory: "Copy always"

What step am I missing?

A: 

Are the resources set to be part of the DLL?

Open the solution Mri.Controls & view the properties of your javascript resource files.
I think that is where the problem could be.

shahkalpesh
My javascript files have the following properties in Mri.Controls - Build Action: Embedded Resource; Copy to Output Directory: Copy always
Travis Johnson
+1  A: 

You are probably missing the [assembly:WebResource("YourNameSpace.YourFile.js", "text/javascript")] attribute. WebResource.axd needs that attribute. You can check this KB article for additional info on the matter.

korchev
I already had [assembly: WebResource("Mri.Controls.Resources.Scripts.Core.js", "text/javascript")] in my assembly info....
Travis Johnson
+2  A: 
Travis Johnson
Im not sure I follow, can you post a small code snippet of what you mean?
Mike Fielden
code snippets added
Travis Johnson
The relevant part is a *static* function: `ScriptManager.RegisterClientScriptResource()` - took me a while before I figured that out.
vdboor