I am trying to follow this answer to add some audio files to the windows phone emulator's media library. But I get the error
The type or namespace name 'PhoneExtensions' does not exist in the namespace 'Microsoft.Xna.Framework.Media' (are you missing an assembly reference?)`
I am unable to reference microsoft.xna.framework.media.phoneextensions.dll as it is not present at the location
C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71
I installed Microsoft XNA Game Studio 4.0 but still could not find the dll in the system folders.
I tried but couldn't get the dll anywhere on internet.
Here's my code (if it matters)
Uri file = new Uri("files/a_wink.mp3", UriKind.Relative);
var myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
var fileStream = myIsolatedStorage.CreateFile("a_wink.mp3");
var resource = Application.GetResourceStream(file);
int chunkSize = 2000000;
byte[] bytes = new byte[chunkSize];
int byteCount;
while ((byteCount = resource.Stream.Read(bytes, 0, chunkSize)) > 0)
fileStream.Write(bytes, 0, byteCount);
fileStream.Close();
Microsoft.Xna.Framework.Media.PhoneExtensions.SongMetadata metaData =
new Microsoft.Xna.Framework.Media.PhoneExtensions.SongMetadata();
metaData.AlbumName = "Some Album name";
metaData.ArtistName = "Some Artist Name";
metaData.GenreName = "test";
metaData.Name = "someSongName";
var ml = new MediaLibrary();
Uri songUri = new Uri("someSong.mp3", UriKind.RelativeOrAbsolute);
var song =
Microsoft.Xna.Framework.Media.PhoneExtensions.MediaLibraryExtensions.SaveSong(
ml, songUri, metaData,
Microsoft.Xna.Framework.Media.PhoneExtensions.SaveSongOperation.CopyToLibrary
);
Edit: I am using Windows Phone SDK 7.1 on Vista Home Basic.
You can find the library here once you have installed WP8 SDK
If you can't install WP8 SDK's You can find the XNA Framework dlls here: