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
  • 64,767
  • 30
  • 146
  • 239
msbg
  • 4,852
  • 11
  • 44
  • 73

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
  • 123,504
  • 12
  • 155
  • 268