WebResources and SharePoint

As I discussed in FIX: "WebForm_PostBackOptions is undefined" where I referred to WebResources as a possible magic-bullet for SharePoint Son of SmartPart (ASP.NET 2.0 UserControl) developers, I spent some time trying to get it working in our project. This is of course after repairing my VS2005 install (C# intellisense support refused to load after installing the Web Deployment project add-in). Anyway, the plan was to reduce the number of files I needed to copy over for a "deployment" of our product to SharePoint.

After a few hours of wondering WTF was going on (the scripts were being added but were unavailable), I chanced upon Helen's TechBlog post about WebResources aren't cached when debug is set to true in your web.config.

My research suggests that regardless of this caching isn't enabled at all on Cassini (aka the ASP.NET development server). It doesn't seem to even cache static files and it doesn't seem to matter whether debug is set to true or not. So don't stress out if you're testing caching in development and you can't get it working.

So Cassini doesn't support WebResources... and IIS6 only supports them if debug is set to false in a web.config?! Why the hell would they put those limitations in place? AHHHHHHH. (Sorry, Helen. I feel the need to stress out right now).

posted @ Friday, March 24, 2006 1:13 PM

Print

Comments on this entry:

# re: WebResources and SharePoint

Left by Helen Emerson at 3/30/2006 6:00 AM
Gravatar
Hi. I found your link in my referer logs. :)

I wasn't saying web resources won't work in Cassini, just that caching isn't turned on so the javascript files would be downloaded each time the browser hit the page. They'll still work fine, it's just more traffic between the browser and the server and in development that really doesn't matter.

The trickiest thing I found about doing web resources was getting the reference to it right. It does something a bit unintuitive with the default namespace (I forget what exactly) and the best way to find out what your resources are really being called is to iterate through all the resources in your assembly like this:

string[] resources =
this.GetType().Assembly.GetManifestResourceNames();
foreach (string resourceName in resources)
{
Debug.WriteLine(resourceName);
}

I don't know if you saw this when you visted my site, but I've got a few other tips for getting resources working as well in this article:
http://webdev.helephant.com/blog/asp.net/webresourceattribute

# re: WebResources and SharePoint

Left by Steve Hartzog at 4/1/2006 8:42 AM
Gravatar
Cool. Thanks for clarifying Helen! Though I had so many problems getting it all to work inside of Son of SmartPart inside of SharePoint that I just put it all in wpresources. Sure I have to copy more when I deploy - but I had a deadline, and this way worked immediately. I figure I'll get this working for our next release. Thanks again, Helen - you are the bomb.

Your comment:



 (will not be displayed)


 
 
 
Please add 3 and 4 and type the answer here:
 

Live Comment Preview:

 
«December»
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910