How to create Content Project in Visual Studio 2013

Topics: Content Building and Deploying
Feb 18, 2014 at 1:59 PM
Although I can see content projects in the Angry Ninjas WP and Windows store samples, and I see that the Angry Ninjas Android project references built xnb files - I do not see how to add any content projects of my own to a Visual Studio 2013 cocos2d-xna setup.

  1. I have installed all of the cocos2d-xna extensions. Note, I did not see a Cocos2d-XNA Monogame Content Builder extension as seen in this screenshot:
Feb 18, 2014 at 5:45 PM
You don't need to generate xnb files for simple assets like PNG, WAV, MP3, etc. You would only need that for the 3D content support in MonoGame.

Just create a Content folder and then add the raw assets there as Content and mark them as "Copy if Newer".

That will get you going.


Just like that.
Feb 18, 2014 at 6:20 PM
Cool, thanks. Just one sanity check, in XNA-based games, I thought we were supposed to convert our assets to xnb for performance reasons. Is that no longer a necessity?

Feb 18, 2014 at 6:29 PM
For cocos2d-xna, there is no performance improvement with XNB. XNB was there just for compatibility and for packaging assets that required more elaborate management like 3D FBX files. On Windows Phone 8 you may still need to include the XNB files for audio assets that use wma because there is some header information stored in the xnb file. The image assets can all be loaded as raw assets now. That will work on all platforms, including iOS, which is more desirable (the compiler will preprocess the images for you).

There is pre-processed texture compression that could target the host GPU, such as in the processing of DXT compressed textures. This has a marginal improvement on texture loading and game startup, but you would only see that on games with many assets to preload.

For cocos2d-xna games, the use of raw assets will be fine.

If you have problems loading raw assets, then you would need to use either a Windows XNA content project, or else use the MonoGame command line content builder. The MGCB content builder project only works with VS2010 and VS2012. I have not updated it to work with VS2013 yet.
Feb 19, 2014 at 9:52 PM
I was unable to get raw assets (png's, etc.) to load in my VS2013 setup for Windows Phone and Windows Store. However, swapping in their xnb equivalent and I was able to run successfully.

Here are notes on my current setup to incorporate xnb's into a VS2013 setup for Windows Phone and Windows Store:
  1. Get the VS2013 setup from here
  2. After installing, add an xna content project to your solution and add your content to a Content folder for this project.
  3. Add a dummy xna library project to your solution and add a content reference to the xna content project you just added above. This is so you can produce compiled xnb files by building the xna library project.
  4. From your original VS2013 Cocos2d-XNA project, use file linking to point to the xnb's you created in step 3.
Please modify as you see fit for other users who may be stumbling on getting a VS2013 setup in place for Windows Phone and Windows Store.

Feb 19, 2014 at 10:20 PM
That MSXNA project is unlikely to be around much longer. It's a clear violation of copyright protection on Microsoft's code. Be careful about using it. I would recommend not using it because it is a disassembly of the XNA Game Studio 4 libraries from Microsoft. Nobody has the legal right to disassemble Microsoft code and publish it.

You can make use of XNA Game Studio 4 if you have a windows 7 install. Just setup a vm with windows 7 pro, then install XNA Game Studio 4 from Microsoft, with refresh 1. That will get you running with content project building. You can then setup a simple content builder project that you can run with nAnt. That way you can build by command line, copy the output to your wp8 project, and get running. You can do that with VS2010 as well, maybe even VS2008.

The content project should be able to be linked into your main game project. You just add a reference to the content project and its output will be copied to your bin directory of the game project. Just set the output folder to be bin/Debug/Content or something like that. That is how kjpou was able to get content builder projects to push content into the template projects.