Currently I am a working on a small XNA project whose solution is composed of 4 projects, a DLL, a Windows Game, a Xbox 360 game, and a level editor. Each projects needs access to my assets (currently just 2d sprites), and has raised the interesting question of how to easily share them between each project.
What I had been doing was adding the assets to the Windows game as pipeline content. After compiling it I would then copy the compiled assets from the bin directory, to the bin directories of the level editor and the Xbox 360 game. While this worked, it was error prone and time consuming.
Instead I found that I can add my assets to the DLL as embedded content, and then load them at runtime. Normally you would have probably loaded content by calling the "Load" method of "ContentManager", like:
As stated above, the problem with this solution is that "mySprite" would have had to been compiled into the content pipeline. When your assets are added as embedded content, the above method does not work. Instead, you can load your content like this:
Assembly asm = Assembly.GetExecutingAssembly();