2

I have a WPF app with image resources. When I build the program, there is a directory named "resources" in the bin folder containing my images. If I run the program without the folder, it crashes. How can I embed the resources in the app so it can run stand alone?

ThinkingStiff
  • 63,812
  • 29
  • 142
  • 238
msbg
  • 4,634
  • 10
  • 43
  • 72

1 Answers1

7

You have to set the build action of the image files to Resource, like shows here. The Uri for an image file named Image.png would then be this:

pack://application:,,,/Resources/Image.png

See also the MSDN page Pack URIs in WPF.

Community
  • 1
  • 1
Clemens
  • 117,112
  • 10
  • 139
  • 247