Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking Content Project (XNA) to a non XNA project

Can I reference a Content Project to a Non-XNA project (MonoGame, if it's important)?

like image 759
Gilad Naaman Avatar asked Jun 06 '12 16:06

Gilad Naaman


1 Answers

Not directly.

The ability to add a content project reference to a project is only available for projects of the types "XNA Game" and "XNA Game Library".

One trick that I use when I want to build and include an XNA Content Project in a WinForms project is to make an empty XNA Game Library project. Reference the XNA Game Library project from the main (Windows) project, and the Content Project from the XNA Game Library project.

Whether this will work for MonoGame is another matter.

The alternative is to simply have a blank XNA Game project that references the content project. Then set up the project dependencies so the XNA Game will rebuild first if necessary. If you need to copy the output files around, perhaps do it as a post-build step?

The sledgehammer option would be to create a custom MSBuild file that does exactly what you want.

like image 69
Andrew Russell Avatar answered Sep 23 '22 13:09

Andrew Russell