❔ C# WPF playing background music
Hello, I have WPF app for game launcher/updater. I wanted to add background music, so I added this code to my UI.xaml:
<MediaElement Name="backgroundMusicPlayer" LoadedBehavior="Play" Visibility="Hidden" Source="../Resources/Music/theme.mp3"/>
In Visual Studio it works as expected, the music is being played. But if I build the solution, music is not playing.
The "theme.mp3" resource has Build Action = Resource and Copy to Output Directory = Do not copy, since I need the mp3 inside the exe.
Could someone point me to what I'm doing wrong? Thank you!2 Replies