TAGS :Viewed: 15 - Published at: a few seconds ago

[ Best way to access images outside of a project? ]

I currently have several WPF projects that need to access a folder of images. What would the best way be to allow the projects to have access to the same images folder w/out duplication?

example structure:

  • Root Folder
    • Images
    • Project 1
    • Project 2
    • Project 3

I'm familiar w/ adding the "needed" images to the actual project itself, but am looking for a solution for the projects to have the same "central" library of images.

Answer 1


You can place all your images in a central project and reference them via the pack syntax throughout your solution.

ImageSource="pack://application:,,,/MyProject;component/Images/MyImage.png"

Answer 2


If you wanted to reduce the size of your deployed assembly and to keep the image files 'loose', you might consider the 'site of origin' scheme. It is the same format, but uses 'siteoforigin' for the authority rather than 'application'.

pack://siteoforigin:,,,/Subfolder/SiteOfOriginFile.jpg

Answer 3


You can have the path to those images in your application.This will avoid the copy of images in your project. But if you package installer you need to package them properly.