SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing lots of web parts and of course i'm doing this all locally then uploading to the live online SP2010.

I'm needing to write a lot of extra code to accommodate the file paths of images and CSS files etc and its becoming a bit of a headache, has anyone else ran into this? Any tips or solutions to reduce the number of If then else?!



share|improve this question
Can you give examples of that you need to change and why are the paths different in your local environment? – Per Jakobsen Oct 15 '12 at 16:40

where are you deploying images and CSS files? is it in some doc lib of the site itself, or in layout folder, if you deploy them in layout folder then you should not run into this problem, just refer your resource with virtual path like "/_layouts/YourFolderName/resource" but for some reason if your files has to be in site's library then I guess you will face some problem if you dont know the library name or library structure at the time of development.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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