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 ex
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
string path = "c:\Projects\ProjectFolder\FileName";
do it like that :
string currentDir = AppDomain.CurrentDomain.BaseDirectory;
string fullPath = currentDir + "ContentFolder/FileName.mp3(or whatever)";
Edit :
AppDomain.CurrentDomain.BaseDirectory
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.