Lufthansa
Lufthansa

Reputation: 145

combine c# program and stuff in just 1 program

I have pictures, gifs, textfiles, console applications needed by my c# program. They are all in the same directory with my c# program.

If they downloaded my program, it should be in a single package, a single exe file, all the pics are there, all the dependencies, console apps, bat files.

How can I combine everything in one package? So that users will not see all textfiles, gifs, etc.?

Upvotes: 2

Views: 168

Answers (4)

tobias86
tobias86

Reputation: 5029

As mentioned, you need to add the content as Resources to your application. If you're using Visual Studio, just right-click your project and select "Add new Item..."

Then in the list, select "Resource File" (file should be something like Resources.resx)

Then in your Solution Explorer, just open the resource file and add your content to it.

To access it in code, just go

Bitmap image = Resources.myImage;

or

string textData = Resources.myTextData;

Upvotes: 0

FIre Panda
FIre Panda

Reputation: 6637

You need to use resources to embed images etc in the assembly. Have a look at this link.

Upvotes: 3

kunal
kunal

Reputation: 966

You should use the visual studio deployment wizard to make a setup project that will include all the files and will execute your exe while the installation is in progress and when you build your application there will be only one file "exe or msi".For this Go to Projects->setup and Deployment->Setup project and then create one.You can search online or msdn provides very good samples for that as well.

Thanks

Upvotes: 1

Glenn Ferrie
Glenn Ferrie

Reputation: 10400

You need to make them Embedded Resources. you can set that in the Property window when the resources are selected in the Solution Explorer.

Upvotes: 4

Related Questions