I have a program that plays a sound but if I run it on a different computer it says that the file isn't found how do I attach the file onto the exe so when someone plays the exe it will still be able to play?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
When Packaging your project files create a folder inside your project folder to hold your content data (text - pictures - videos - sound .. etc) and then supply your code with the relative path of your target file rather than the absolute path .
for example : instead of
do it like that :
Edit :
Will be the application root directory, not the bin subfolder - which is probably what you usually want. In a client app, it will be the directory containing the main executable.
If you cannot change the source code,I suggest
http://m.instructables.com/id/How-to-create-portable-app/?ALLSTEPS
It is about creating new exe archive containing old exe+new files you want to merge. When you call that new exe, it runs your old exe, but also contain your music files You can follow step4 and 5
Put your exe and music files into the same folder and compress them through that method
You can go the properties of the file, and under Copy to output Directory select, copy if newer
You can package the EXE with your c# program when you are ready to release it with an installer
If you are wanting to embed your wave file into your program, go to your Project Properties --> Resources --> Select Audio as the type then select Add Resource and select your Audio File. This will add the Audio File to your Resources Directory. Once you have done this you can right click on the File in the Resources folder and select Properties and change the Build Action to
Embedded Resource
.To access the file you would do something like this: