I wrote a project in C# that uses a lot of images, Milk models and openGL and i want to pack everything in one exe so i can upload it to my site. Right now i got an exe that is depended on other files like jpgs etc'. I've tried using ILMerge but couldn't get it to work. Is there a simpler solution? thanks.
Add that as an embedded resource.
Inside Visual Studio :
You will have that image inside the exe. Later you can use Reflection and get the image when you run your application.
========= Getting the Embedded image from the Application =========
First solve the first problem: by putting images as embedded resource.
Second problem: Access the images by using Reflection:
private void Form1_Load(System.Object sender, System.EventArgs e)
{
System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
Stream myStream = myAssembly.GetManifestResourceStream("EmbeddingExample.image1.bmp");
Bitmap image = new Bitmap(myStream);
this.ClientSize = new Size(image.Width, image.Height);
PictureBox pb = new PictureBox();
pb.Image = image;
pb.Dock = DockStyle.Fill;
this.Controls.Add(pb);
}
Borrowed Source Code from here: