0

I'm making a C# WPF application on Visual Studio 2013. My application has an image in it called mainImage. I made all the images I need in my program to be a Resource. and then I was changing the image in my application with a code like this :

mainImage.Source = myWindow.FindResource("image") as BitmapImage;

The problem is that when I take my .exe and try to run it without the whole project, It gives an exception because it can't find the image. I want my images to be something like "part of the application", so that wherever I run my application (even if I run it separately from the Visual Studio project), I want the images to show up. Can any one help me with that?

Said A. Sryheni
  • 697
  • 1
  • 9
  • 29
  • You need to make sure the image is embedded correctly in the assembly. See http://stackoverflow.com/questions/638845/wpf-image-is-not-part-of-the-project-or-its-build-action-is-not-set-to-resour?rq=1 – Emond Jun 22 '15 at 19:06
  • This Microsoft article explains how to make and use embedded resources. Embedded resources are compiled into the assembly. https://support.microsoft.com/en-us/kb/319292 – Kevin Jun 22 '15 at 19:09

0 Answers0