I'm using VS 2010 to create a SP 2010 web part. I want to include my images, css files and js files in the VS project, and have them be deployed to the correct location. My understanding is that I should be using SPWebPartManager.GetClassResourcePath() to get the urls for these items, and that the files should end up in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\wpresources\{web part name}\{version}__{pk token}.

  1. Is the above correct, or is there a better way?

  2. How to I include these fines in the VS project so that they are deployed to this location - e.g. is there a SharePoint mapped folder I have to put them in?

1 Answer 1


To deploy it to the wpresources location then you add the resources to the SPI (SharePoint item) in Visual Studio. For instance righ-click on a Web Part item and then add an existing item. Select the new item and look at its properties (F4) and check the Deployment Type. It should be set to NoDeployment by default. Change it to ClassResource...tada...done!

This will add the necessary XML elements (ClassResources/ClassResource) to your package

  • Awesome! It looks like I have to set this property per-file rather than per-folder (e.g. every image instead of the images folder). Is there quicker way?
    – bmm6o
    Apr 29, 2010 at 20:34
  • You have to set it per file so that VS adds it automatically to the solution package. Apr 29, 2010 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.