msbg
msbg

Reputation: 4972

How to build a stand alone exe with resources?

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?

Upvotes: 2

Views: 3746

Answers (1)

Clemens
Clemens

Reputation: 128077

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.

Upvotes: 7

Related Questions