Too many files deployed

Nov 11, 2008 at 11:53 AM
I'm developing a web part to deploy to bin directory. This web part uses few css and png files that I want to deploy with web part.

This is my structure:
12/TEMPLATE/MyWP/feature.xml, MyWP.webpart
80/wpresources/MyWP/MyWP.css, MyWP.png

In "WSPBuilder.exe.config" I set "DeploymentTarget" to "BIN".

When I "Build WSP", manifest.xml contains two sets of files under 80/wpresources. One in Assemblies/Assembly/ClassResources and the other in ApplicationResourceFiles. This results in deployment of those files to <webapp>/wpresources/MyWP/ and to <webapp>/resources/MyWP/.

I don't think I need those files deployed to both folders. So why does this happen? Is it a bug or a feature? Can I tell wspbuilder to create only ClassResources node (which seems to be the correct one)?

Feb 23, 2009 at 3:31 PM
I am having exactly the same problem. My project has many images (gif, png). When I build with WSPBuilder, the .wsp contains multiple copies of the image files. When .wsp is deployed it creates two sets of the same files in two locations: one in 80\wpresources and another in 80\resources. 

Any solution?
Jun 25, 2009 at 6:27 AM

In my solution the .wsp-file also contains the images twice. In a previous version ( it always works fine. I want the files only to deploy in the "...\web server extensions\wpresources"-folder. The "GAC"-folder in my solution contains the ddl. How can I solve this problem?

Jul 23, 2009 at 1:39 PM

I want to know too, how can I get my files in "..\web server extensions\wpresources" ???

Jul 24, 2009 at 5:50 AM

GOT IT !!!

In your project, create the \80\ folder and then create a subfolder with your project's name. The result (on disk!!!) should be like this:


So if you're project would be named "ResourcesTest" it'd be like having the folder inside your project like "80\ResourcesTest\somefile.jpg"

Pull it out like this:

SPWeb currentWeb = SPControl.GetContextWeb(Context);
Type currentType = this.GetType();
string classResourcePath = SPWebPartManager.GetClassResourcePath(currentWeb, currentType);

And then do classResourcePath + "\somefile.jpg" and you've got the location! :)

Jul 24, 2009 at 6:03 AM

More detailed explanation here :