I have made a game in Visual Studio 2013 Ultimate. The game has sounds and background music. Sounds are played with "SoundPlayer" (button clicks) and bcg music with "WindowsMediaPlayer." All .wav files are situated in "Resources" expect bcg music file. This file is placed in bin/Debug/ (or after Release in Bin/Release/) because WMplayer cant play it from Resources (WMplayer has only property URL and "player.URL = Properties.Resources.backgrounmusicfile" doesnt work). Now I have Release directory with exe file, dll, ...and bcg music wav file. When I try it to merge in one single exe file with "ILMerge" it doesnt merge bcg music wav file. All in all I have 1 merged exe file and 1 bcg music wav file in the same directory to run game properly. My objective is to have only one single exe file. Does exist any way how to reach this? Thanks.
-
This question seems to help you... http://stackoverflow.com/questions/8333340/how-to-export-exe-files-in-visual-studio-with-all-used-files – Kavindu Dodanduwa Jan 27 '15 at 08:30
-
1Are you asking about installation file? Software product are usually (not always) distributed by using installation packet, NSIS can produce single exe installation. If you mean single exe for application, then you have a problem - WMP and resources ([click](http://stackoverflow.com/q/17410199/1997232)), possible solution would be to extract wav from resources (into temp or cache folder) when your application is started. ILMerge only merges assemblies, it can't merge wav, unless wav is inside assembly (resource). – Sinatr Jan 27 '15 at 09:19
-
I tried these tips but it seems I am not able to solve it. I decided to leave it as two-file folder (.exe file + .wav file). Thanks for your time and help. – df306 Jan 27 '15 at 11:19
1 Answers
ILMerge supports .Net assemblies only. ILMerge can't "embed" some data file into an exe.
What you need is called application virtualization: an emulation of files. This method is based on hooks. Each system call related with the file subsystem is being intercepted and preprocessed. This allows to emulate files and directories, thus a process "thinks" that these files really exists.
Unfortunately I don't know free solutions but there are 3rd party ones.
With BoxedApp SDK you need to create a virtual file (see BoxedAppSDK_CreateVirtualFile) with your wav file's data.
With BoxedApp Packer you need to create a project specifying your main exe as input exe and put the WAV file into special folder <ExeDir>
. Final packed exe (a single exe as required) will work as the WAV file really exists.

- 1,234
- 8
- 22