[MonoDevelop] How to Embed a Configuration File in an Assembly?

Jacek Ruzyczka ruzyczka at versanet.de
Mon Aug 20 15:26:01 EDT 2007

Hi Sandy,

> You must create it yourself (Visual Studio would auto-generate it in
> each project as needed).
OK...in fact, I was hunting for the Assembly class, which turned out to be 
placed in System.Reflection.

> Look again at the example that uses System.Media.SoundPlayer.  You can
> pass in a stream instead of a string.  Probably you can just pass in
> the return value of GetManifestResourceStream, or a FileStream that
> wraps that.
The example seems to work...but I don't hear any sounds. :-( Here's my 

using System;
using System.Media;
using System.IO;
using System.Reflection;
using Gtk;

namespace iwawi
	///Static utility class playing sounds.
	public class SoundPlayer
		private SoundPlayer()
		///Plays a sound to indicate success.
		public static void PlaySuccessSound()
			Assembly a = Assembly.GetExecutingAssembly();
			Stream s = a.GetManifestResourceStream("success.wav");
			System.Media.SoundPlayer sp = new System.Media.SoundPlayer(s);

Everrything except the sp.Play() method works fine. In fact, this problem 
seems to appear on Microsoft .NET as well (see 
http://www.groupsrv.com/dotnet/post-722330.html). Maybe this is a matter for 
the Mono developers themselves, as at some point, Mono has to call native 
methods of the sound system (aRts in my case)...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/monodevelop-list/attachments/20070820/f5cee386/attachment.bin 

More information about the Monodevelop-list mailing list