WebResource.axd blank or not found

taco picture taco · Apr 8, 2009 · Viewed 8k times · Source

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?

Answer

Atanas Korchev picture Atanas Korchev · Apr 8, 2009

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.