When I publish my app and run it, it says that it couldn't find the path to sound.wav
file and it crashes.
I put my sound files into a bin/Debug/sound
folder, and use it like this in my code:
public void OpenInventory()
{
SoundPlayer inventory = new SoundPlayer("sound/selection2.wav");
inventory.Play();
try
{
var item = Item.itemList.SingleOrDefault(x => x.Amount == 0);
if (item != null)
{
Item.itemList.Remove(item);
}
var loot = Loot.lootList.SingleOrDefault(c => c.Amount == 0);
if (loot != null)
{
Loot.lootList.Remove(loot);
}
}
catch
{
inter.InventoryArray();
UseItem();
}
inter.InventoryArray();
UseItem();
}